• Posiadam szablon Independent Publisher, jestem bardzo początkująca i chciałabym na stronie głównej wyświetlać teasery postów. Wiem, że w pliku index.php należy zamienić 'the_content’ na 'the_excerpt()’ ale to nie daje rezultatów. Może w innym pliku też powinnam to zmienić?
    Załączam fragment oryginalnego kodu. zmieniam tylko pogrubiony fragment

    <?php if ( have_posts() ) : ?>
    
    				<?php /* Start the Loop */ ?>
    				<?php while ( have_posts() ) : <strong>the_content()</strong>; ?>
    
    					<?php
    					/* Include the Post-Format-specific template for the content.
    					 * If you want to override this in a child theme then include a file
    					 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    					 */
    					get_template_part( 'content', get_post_format() );
    
    					?>
    
    				<?php endwhile; ?>
    
    				<?php independent_publisher_content_nav( 'nav-below' ); ?>
    
    			<?php else : ?>
    
    				<?php get_template_part( 'content', 'none' ); ?>
    
    			<?php endif; ?>

Zobacz 3 odpowiedzi - od 1 do 3 (z 3 łącznie)
  • Ale w tamtym miejscu jest the_post(); (i the_post() winno tam pozostać)- a to zupełnie inna bajka 😉

    Aby włączyć zajawki wystarczy ze wejdziesz w Wygląd >> Personalizacja >> Excerpt Options i ustawisz Post Excerpts na Enabled

    A jak by się upierać przy takiej modyfikacji pliku, to trzeba by w content.php podmienić the_content( independent_publisher_continue_reading_text() );

    Twórca wątku martakk

    (@martakk)

    Wszystko działa! Pomyliłam stronę z wpisem, aż mi wstyd. A gdybym chciała tak samo skrócić strony? I czy to w ogóle miałoby jakiś sens?

    raczej nie miało by to większego sensu

Zobacz 3 odpowiedzi - od 1 do 3 (z 3 łącznie)

Temat ‘Funkcja the_excerpt() nie działa’ jest zamknięty na nowe odpowiedzi.