WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Fourteen
Don't show excerpt in search page (2 posts)

  1. Hannes Salen
    Member
    Posted 5 months ago #

    Hi,

    I don't want the search page to show the excerpts of the posts, I'd like it to show the posts the same as in the categorypages, so that for longer posts you see the continue reading link. I presume I have to change something in my childs theme content.php, but I don't know what exactly? Can anyone help me?

    thanks,

    Hannes

  2. Hannes Salen
    Member
    Posted 4 months ago #

    I found a way to do this, I changed in content.php the first part of the search part by the second part of the if-else. There should probably be an easier way, because now I have an if-else with twice the same code, but it works! If anybody has a better solution, please be free to share ...

    <?php if ( is_search() ) : ?>
    	<div class="entry-summary">
    		<?php the_excerpt(); ?>
    	</div><!-- .entry-summary -->
    	<?php else : ?>
    	<div class="entry-content">
    		<?php
    			the_content( __( 'Read more <span class="meta-nav">→</span>', 'twentyfourteen' ) );
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    			) );
    		?>
    	</div><!-- .entry-content -->
    	<?php endif; ?>

    is now :

    <?php if ( is_search() ) : ?>
    	<div class="entry-summary">
    		<?php
    			the_content( __( 'Read more <span class="meta-nav">→</span>', 'twentyfourteen' ) );
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    			) );
    		?>
    	</div><!-- .entry-summary -->
    	<?php else : ?>
    	<div class="entry-content">
    		<?php
    			the_content( __( 'Read more <span class="meta-nav">→</span>', 'twentyfourteen' ) );
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    			) );
    		?>
    	</div><!-- .entry-content -->
    	<?php endif; ?>

Reply

You must log in to post.

About this Theme

About this Topic