Change presentation of search results?
-
Hello,
I am trying and failing to change the way the search results are presented. Instead of a listing without images I would like it to look just like every other page, images with post-titles that appear on hovering the image. Thus I just copied some lines of the archive.php and pasted it into the search.php, but it doesn’t work as intended – there are now images, but they are still “listed” and the post-titles are shown right under the images.
Here are some screenshots – this is what I would like the page to look like: What I want
and this is what I get: What I getAnd this is the code I replaced – I took this in search.php:
<?php $counter = 1; ?> <?php while ( have_posts() ) : the_post(); ?> <?php do_atomic( 'before_entry' ); // hatch_before_entry ?> <?php if ( ( $counter % 2 ) == 0 ) { ?> <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?> last"> <?php } else { ?> <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>"> <?php } ?> <?php do_atomic( 'open_entry' ); // hatch_open_entry ?> <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?> <?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( '[entry-published] [entry-author]', 'hatch' ) . '</div>' ); ?> <div class="entry-summary"> <?php the_excerpt(); ?> <?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'hatch' ), 'after' => '</p>' ) ); ?> </div><!-- .entry-summary --> <?php do_atomic( 'close_entry' ); // hatch_close_entry ?> </div><!-- .hentry --> <?php do_atomic( 'after_entry' ); // hatch_after_entry ?> <?php $counter++; ?> <?php endwhile; ?>
and replaced it by these lines from archive.php:
<?php $counter = 1; ?> <?php while ( have_posts() ) : the_post(); ?> <?php do_atomic( 'before_entry' ); // hatch_before_entry ?> <?php if ( ( $counter % 4 ) == 0 ) { ?> <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?> last"> <?php } else { ?> <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>"> <?php } ?> <?php do_atomic( 'open_entry' ); // hatch_open_entry ?> <?php if ( current_theme_supports( 'get-the-image' ) ) { get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'archive-thumbnail', 'image_class' => 'featured', 'width' => 220, 'height' => 150, 'default_image' => get_template_directory_uri() . '/images/archive_image_placeholder.png' ) ); } ?> <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?> <?php do_atomic( 'close_entry' ); // hatch_close_entry ?> </div><!-- .hentry --> <?php do_atomic( 'after_entry' ); // hatch_after_entry ?> <?php $counter++; ?> <?php endwhile; ?>
What did I do wrong? Do I have to alter the stylesheet? Or does the search.php has to be registered somewhere?
Thanks in advance!
Abalone
- The topic ‘Change presentation of search results?’ is closed to new replies.