The theme I am using renders any archive or category list page in a weird way. First, it creates a very large featured image. Second, it renders all of the relevant posts, and not just the excerpts. I am by no means a WordPress wiz, but I know enough things to get into trouble. Here’s how I solved it.
I went into Appearance > Theme File Editor, and in archive.php, I changed the content type to “content-search” rather than just “content”. Then I was able to reformat the search template, which was much closer to what I wanted. Here is my new version of the search template:
<?php
/**
* Template part for displaying results in search pages
*
* @package AnaLog
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
<?php if ( 'post' === get_post_type() ) : ?>
<div class="entry-meta">
<?php
analog_posted_on();
analog_posted_by();
?>
</div><!-- .entry-meta -->
<?php endif; ?>
</header><!-- .entry-header -->
<div class="entry-summary" style="display:inline-block; vertical-align: top; width:100%;">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<div class="entry-image" style=" max-width:60%; margin: auto;">
<?php analog_post_thumbnail(); ?>
</div>
<?php the_title( sprintf( '<p class="read-more"><a href="%s" rel="bookmark">Click here to read more about "', esc_url( get_permalink() ) ), '"...</a></p>' ); ?>
<footer class="entry-footer">
<?php analog_entry_footer(); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-<?php the_ID(); ?> -->
It’s not entirely clear that you have to click the title to read more, so I decided to add a clarifying “Click to read more link” I’m almost certain I didn’t do it the proper way, but it appears to be working reliably. I also had to add in a bit of custom CSS to make that link look reasonable:
.read-more {
font-size: smaller;
margin-bottom: 0px;
margin-top: 0px;
float:bottom;
font-weight: bold;
}
.entry-footer{
margin-top:0;
}