• 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

Viewing 1 replies (of 1 total)
  • Thread Starter Hannes Salen

    (@hannes-salen)

    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; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Don't show excerpt in search page’ is closed to new replies.