WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Override More-Tag doesn't work (4 posts)

  1. RJonathan
    Member
    Posted 1 year ago #

    Hello,

    I' not really into coding, so maybe I'm missing something very stupid here.
    I want to use more-tags for the mainpage of my yoko-child-theme to show customized excerpts. But on the category-pages I want the whole texts to be shown.
    So I tried this code, but it doesn't work. The category-pages still show customized excerpts. Do you have any idea why?

    <div class="entry-content">
    		<?php if ( is_category() ) : // Override more-tag for category. ?>
    			<?php global $more;    // Declare global $more (before the loop).
    			$more = 0;    // Set to display content above the more tag.
    			the_content( __( 'Continue Reading &rarr;', 'yoko' ) ); ?>
    			<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'yoko' ), 'after' => '</div>' ) ); ?>					
    
     		<?php elseif ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
    			<?php the_excerpt(); ?>			
    
    		<?php else : ?>
    			<?php the_content( __( 'Continue Reading &rarr;', 'yoko' ) ); ?>
    			<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'yoko' ), 'after' => '</div>' ) ); ?>
    		<?php endif; ?>
  2. bcworkz
    Member
    Posted 1 year ago #

    I think you just got $more backwards, try $more = 1;

  3. RJonathan
    Member
    Posted 1 year ago #

    Yes, that works! Thank you, that was stupid, could have tried this by myself.

  4. bcworkz
    Member
    Posted 1 year ago #

    No worries, everyone needs a fresh set of eyes once in a while!

Topic Closed

This topic has been closed to new replies.

About this Topic