My search results page is showing full pages instead of just part of a page and I can't figure out how to change it. I feel like I changed it TO show the full page but I can't remember how I did that and now I want to change it back.

Here is my search.php code.

<?php get_header(); ?>

<div id='container'>

    <?php if ( have_posts() ) : ?>

        <header class="page-header">
            <h1 class="page-title"><?php printf( smt_translate( 'searchresults' ), get_search_query() ); ?></h1>
        </header><!-- .page-header -->

        // Start the loop.
        while ( have_posts() ) : the_post(); ?>

             * Run the loop for the search to output the results.
             * If you want to overload this in a child theme then include a file
             * called content-search.php and that will be used instead.
            get_template_part( 'content', 'get_post_format()' ); 

        // End the loop.

        // Previous/next page navigation.

    // If no content, include the "No posts found" template.
    else :
        get_template_part( 'content', 'none' );



I'm using yoast seo and elementor plugins, so I don't know if that's affecting anything either. Any tips pointing me in the right direction would be great! Everything I've read online says to replace the_content with the_excerpt, but all I have are "content" and I tried replacing those but it either did nothing or search results came up blank.


  • get_template_part( 'content', 'get_post_format()' ); is the line that's telling it to display the full contents. Instead of calling a template part, try replacing that full line with the_excerpt();.
    – WebElaine
    Aug 24, 2018 at 20:54
  • Doing that shows the excerpt...unfortunatlly that's all it shows. Nothing is clickable. no title, just the first part of the text. So...kinda half way there... lol
    – Tigerbite
    Aug 24, 2018 at 21:03
  • What theme are you using? Aug 24, 2018 at 21:04
  • smthemes.com/pokemon I compared the search.php to the original file with what I have now and it's identical. So I guess I changed something elsewhere. I'm so confused and I've been messing with it for 4 hours now
    – Tigerbite
    Aug 24, 2018 at 21:29
  • Ok, one option then would be to copy your content template part file into a new file (perhaps search-excerpt) and just change the call to the_content() there to the_excerpt. You can then call get_template_part('search-excerpt') in search.php.
    – WebElaine
    Aug 24, 2018 at 21:39

1 Answer 1


Go to theme settings in dashboard (Pokemon -> Layout) and set option "Cut content on the Front/Category page" to ON.

Update #1

To change the way posts are displayed only on the search page, you can add || is_search() after smt_getOption( 'layout', 'cuttxton' )

if( smt_getOption( 'layout', 'cuttxton' ) || is_search() )

But it will be better to save the changed content.php file under a new name content_search.php:

    <?php if ( !is_single() ) : ?>

        <!-- ========== Post content in posts feed ========== -->
        <div class="entry-summary">
                if ( ! post_password_required() ) { 
                    smt_excerpt( 'echo=1' );
                } else the_content( );
            <a href='<?php the_permalink(); ?>' class='button'><?php echo smt_translate( 'readmore' ); ?></a>
            <span class='post-categories'><?php the_category(' '); ?></span> 
        </div><!-- .entry-summary -->

    <?php endif; ?> 

    <div class="clear"></div>
</article><!-- #post-## -->

and in search.php use the new template file:

// Start the loop.
while ( have_posts() ) : the_post();

    get_template_part( 'content_search' ); 

// End the loop.

Excerpt lenght

The excerpt lenght can be changed with excerpt_length filter (doc). You can also change length of excerpt in your theme options ("Pokemon" -> "Layout" -> "The default excerpt length").

Code goes to functions.php:

function custom_excerpt_length( $length ) {
    return 20;  // number of words
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
  • That setting is on. I'm on mobile atm and can't test your code but does that affect the search results page or the main pages?
    – Tigerbite
    Aug 24, 2018 at 23:19
  • Okay so that code work, but I'm just curious, does that change stuff anywhere else other than the search results? I don't want to run into something random that I'm not aware of. Thanks for the help!
    – Tigerbite
    Aug 25, 2018 at 2:22
  • Yes, this change affects also archive and front page (main page). Do you want show excerpt only on search and full content in other places (main page, archive page)? @Tigerbite
    – nmr
    Aug 25, 2018 at 5:26
  • This is okay unless it's simple to do the excerpt only on search. Also, where/how can I change how long the excerpt is? Thanks for the help!
    – Tigerbite
    Aug 25, 2018 at 12:24
  • I updated the answer. @Tigerbite
    – nmr
    Aug 25, 2018 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.