• On my search results page, I have a page title (Search Results) that’s in an h1 tag; however, all the results returned in a search, their titles are also in h1 tags, so my search results page has about 15 h1 tags on it when it really should be in h2 tags. Is there an easy way to have the search result titles display in h2 tags just on this page?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Which theme are you using?

    Thread Starter jamieb7210

    (@jamieb7210)

    twenty eleven

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    As this is part of the theme, you’ll need to create a Child Theme and modify the HTML elements in which the search results template uses, to use <h2> in stead of <h1>.

    Thread Starter jamieb7210

    (@jamieb7210)

    I’ve never used that before; can you tell me how I would change it so that it only affects the search results and not all of the pages?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You’ll need to duplicate the search results template into your Child Theme. Then edit this duplicate file.

    Thread Starter jamieb7210

    (@jamieb7210)

    Here is the template information; can you tell me what exactly I need to edit to make the title of each search result display in an h2 tag?

    <header class="page-header">
    					<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyeleven' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
    				</header>
    
    				<?php twentyeleven_content_nav( 'nav-above' ); ?>
    
    				<?php /* Start the Loop */ ?>
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php
    						/* Include the Post-Format-specific template for the content.
    						 * If you want to overload this in a child theme then include a file
    						 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    						 */
    						get_template_part( 'content', get_post_format() );
    					?>
    
    				<?php endwhile; ?>
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Here is the template information;

    Is this the file header.php ?

    Thread Starter jamieb7210

    (@jamieb7210)

    this is the search.php page.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Search Results page is outputting h1 tags for each listing’ is closed to new replies.