• Resolved jamiebisson

    (@jamiebisson)


    For SEO purposes I need to change my entry-title from h1 to h2 on my home page, but leave them h1 on all other pages.

    I know this can be done, but it is puzzling me.

    My site is E Advanced Healthcare

    Currently I have my site-title to h1 on home page, which is fine and have changed it to h3 on other pages, so the h1 that i have with the entry-title on the other pages is h1, but i want to change the h1 on entry-title on the home page to h2.

    Any thoughts?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter jamiebisson

    (@jamiebisson)

    I tried this code, but nothing happened. Am i doing something wrong?

    <?php if (is_front_page() ) : ?>
    			<h2 class="entry-title"><?php the_title(); ?></h2>
    			<?php else : ?>
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    			<?php endif; // is_front_page() ?>

    I have also tried .home .entry-title .h1 in the css and nothing.
    I also tried page-id-522 .entry-title .h1 in the css and still nothing.

    try

    <?php if (is_home() ) : ?>

    Thread Starter jamiebisson

    (@jamiebisson)

    and then the rest of the script?

    try it instead of is_front_page. It may be the issue if your home page is not static.

    Thread Starter jamiebisson

    (@jamiebisson)

    nope, that does not work. I tried:

    <?php if (is_home() ) : ?>
    			<h2 class="entry-title"><?php the_title(); ?></h2>
    			<?php else : ?>
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    			<?php endif; // is_home() ?>

    i put it in content.php, is that the right place to try it?

    Thanks for your help.

    I’m not sure where your original code is from, but if you want this to happen on posts it needs to be in single.php.

    Thread Starter jamiebisson

    (@jamiebisson)

    well trial and error I have worked it out… I needed to put this in content-page.php

    After all, it is a page i am editing, not a post

    The page I was having trouble with adjusting was the front page on the website, but this appears to have fixed it.

    Thanks for your help deepbevel, much appreciated!!

    <?php if (is_front_page() ) : ?>
    			<h2 class="entry-title"><?php the_title(); ?></h2>
    			<?php else : ?>
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    			<?php endif; // is_front_page() ?>

    Sorry, at first you said entry title, then site title, I musta got confused as to the goal. Glad you figured it.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Change entry-title on home page to h2 and keep h1 on others’ is closed to new replies.