Search Results Only Showing Excerpts For Posts with Manual Excerpts
-
Hi,
My search results are only showing excerpts for each result for only my posts that have manual excerpts added and not my pages or posts that don’t. Isn’t it possible to have automatic “custom search result snippets” for all posts and pages regardless if there’s manual excerpts for them? I’ve had it work like that before, I believe.
Below is my search.php code:
<?php /** * Template Name: Search Page */ ?> <?php get_header(); ?> <div class="container no-hero-banner"> <div class="page-entry"> <?php global $wp_query; $total_results = $wp_query->found_posts;?> <div class="page-title"> <h1>Search Results</h1></div> <h3><?php printf( __( 'Search Results for: %s', 'shape' ), '<span>' . get_search_query() . '</span>' ); ?></h3> <h5> Total Results: <?php echo $total_results ?> </h5> <hr> <?php if ( have_posts() ) { ?> <?php while ( have_posts() ) { the_post(); ?> <article class="search-result"> <h4><a href="<?php echo get_permalink(); ?>"> <?php relevanssi_the_title(); ?> </a></h4> <div class="search-excerpt"> <?php the_excerpt(); ?> </div> <hr> </article> <?php } ?> <?php echo bootstrap_pagination($query); ?> <?php } ?> </div> </div> <?php get_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Search Results Only Showing Excerpts For Posts with Manual Excerpts’ is closed to new replies.