Getting featured image in serach results
-
Just started using tag cloud and very impressed!
I have set up an ‘alpahbetical tag index’ with a slightly modified index template in my child theme:
<?php get_header(); ?> <?php get_template_part( 'template-parts/global/wrapper-before-blog' ); ?> <h4 class="search-title">Cellar Stage has <?php echo $wp_query->found_posts; ?> <?php _e( 'results')?><br> </h4> <?php if ( have_posts() ) : ?> <div class="ct-posts"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'post-formats/content', 'search' ); ?> <?php endwhile; ?> </div> <?php get_template_part( 'template-parts/pagination' , 'posts' ); ?> <?php else : get_template_part( 'post-formats/content' , 'missing' ); endif; ?> <?php get_template_part( 'template-parts/global/wrapper-after-blog' ); ?> <h4 class="search-title">Another search?: <?php get_search_form( true ); ?></h4> <?php rcblock_by_id( "6302" ); ?> <?php get_footer(); ?>
It calls content-search (which I use for the normal WP search):
<article id="post-<?php the_ID(); ?>" <?php post_class( 'ct-post entry' ); ?>> <h4 class="search-title">Cellar Stage has <?php echo $wp_query->found_posts; ?> <?php _e( 'Results For', 'locale' ); ?>: "<?php the_search_query(); ?>"<br> </h4> <header> <h4 class="search-title"><?php get_template_part( 'template-parts/title', 'loop' ); ?></h4> <?php get_template_part( 'template-parts/featured', 'image' ); ?> <?php get_template_part( 'template-parts/meta', 'loop' ); ?> </header> <div class="ct-post__excerpt"> <?php the_excerpt(); ?> </div> <?php get_template_part( 'template-parts/button', 'read-more'); ?> </article>
It works perfectly except it does not show the ‘template-parts/featured’, ‘image’,
as my normal search results do. Any idea with what I am doing wrong?Thanks in advance for your response.
Kindest
Colin
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Getting featured image in serach results’ is closed to new replies.