- This topic has 2 replies, 2 voices, and was last updated 8 years, 8 months ago by Cattext.
-
AuthorPosts
-
August 11, 2015 at 12:40 am #62729CattextParticipant
Hi Sakin,
I’m looking for a way to customize the way the search results are shown.
I’d like the title of the result to be smaller/H2 or H3.
And I’d like to remove the featured image from the results.
I’ve already copied search.php to my child theme, but my php isn’t good enough to understand what’s going on here.
Or should I adjust CSS settings?August 11, 2015 at 8:25 am #62752SakinKeymasterTo change title from h1 to h3, you need to replace the following code
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'catchkathmandu' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
with
<h2 class="page-title"><?php printf( __( 'Search Results for: %s', 'catchkathmandu' ), '<span>' . get_search_query() . '</span>' ); ?></h2>
Then to remove the image from the search, you need to copy content.php file and then replace
<?php if ( function_exists( 'catchkathmandu_content_image' ) ) : catchkathmandu_content_image(); endif; ?>
with
<?php if ( function_exists( 'catchkathmandu_content_image' ) && !is_search() ) : catchkathmandu_content_image(); endif; ?>
then to change the post title from h1 to h3. replace the following code from content.php
<h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'catchkathmandu' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
with
<h3 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'catchkathmandu' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
August 12, 2015 at 1:32 pm #63193CattextParticipantthanks! I got it all how I wanted it 🙂
-
AuthorPosts
- The topic ‘Customize Search Results page’ is closed to new replies.