Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #62729
    Cattext
    Participant

    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?

    #62752
    Sakin
    Keymaster

    To 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>

    #63193
    Cattext
    Participant

    thanks! I got it all how I wanted it 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Customize Search Results page’ is closed to new replies.