Il titolo non funziona come link

21 gen 2013, 00:47:03
Visualizzazioni: 74
Voti: 0

So che non c'è un tag link intorno al titolo, ma non so dove inserirlo, per favore aiutami :) Questo è il codice

if ($columns->have_posts()) :
    $count = 0;
        while ($columns->have_posts()) : $columns->the_post();
        $count++;
?>
        <div class="slide">
            <div class="slides_thumbnail">
                <a href="<?php the_permalink(); ?>">
                    <div style="width:190px;height:190px;background:url('<?php 
                     $img = get_the_post_thumbnail();
                    eregi("src=\"([^\"]+)\"", $img, $arr);

                    echo $arr[1]; ?>');">&nbsp;</div>

                    <span class="image overlay"></span>
                    <span class="description"></span>
                </a>
            </div><!-- .slides_thumbnail -->
            <h3 class='slide_title'>
                <a href="<?php the_permalink(); ?>"> <?php // Aggiungi il tag link qui

                    $long_title = strip_tags(htmlspecialchars(get_the_title($post->ID)));
                    $short_title = substr($long_title,0,55);

                    if (strlen($long_title) !== strlen($short_title)) {
                        echo $short_title . "... ";
                    } else {
                        echo $short_title;
                    }
                    ?>
                </a>
            </h3><!-- .slide_title -->

            <div class='slide_stats'>
                <?php $more_comments = get_comments_number() . '  Commento(i)'; ?>
                <?php comments_number( "0 Commento(i)", "1  Commento(i)", $more_comments ); ?> 
            </div><!-- .slide_stats -->

            <div class="slides_text">
                <p>
                    <?php 
                    if(function_exists('the_excerpt_max_charlength')) {
                            the_excerpt_max_charlength(300); 
                        } else {
                            the_excerpt(); 
                        }
                    ?>
                </p>
            </div><!-- .slides_text -->
        </div><!-- .slide -->
<?php
    endwhile;
endif;
?>
    </div><!-- .slides_container -->
<?php
if($count > 1) :
?>
        <button class="slide_prev">Precedente</button>
        <button class="slide_next">Successivo</button>
<?php
endif;
?>
</div><!-- .slides -->
0
Tutte le risposte alla domanda 1
0

Devi inserirlo all'interno dei tag <h3>:

<h3 class='slide_title'>
    <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
        <?php
            $long_title = get_the_title(); // Ottiene il titolo completo
            $short_title = substr( $long_title, 0, 55 ); // Taglia il titolo a 55 caratteri

            if ( strlen( $long_title ) !== strlen( $short_title ))  {
                echo $short_title . '&hellip;'; // Aggiunge punti di sospensione se il titolo è stato troncato
            } else {
                echo $short_title; // Mostra il titolo completo se non è stato troncato
            }
        ?>
    </a>
</h3><!-- .slide_title -->

Ho anche sistemato un po' il tuo codice per il titolo :)

21 gen 2013 01:11:19