WordPress.org

Support

Support » How-To and Troubleshooting » Hiding page title while adding H1 tag to homepage

Hiding page title while adding H1 tag to homepage

  • Hi, I am new to wordpress and recently created a wordpress powered website using the photocrati premium theme:
    http://www.foleyphotography.co.uk/

    As the homepage title appears in the navigation and was getting in the way (was a bit long and squashed the navigation links up) I took the title out, but now realise I have no H1 or H2 tags to get picked up by search engines.

    I have checked the forums for advice on hiding my page title but have never played with CSS or PHP before so a bit unsure what’s the most foolproof way to do this. I tried a plugin (‘Exclude pages from navigation’ by Simon Wheatley) which hides the page title but it also hides it when I check the page source code so not sure whether search engines would pick it up either!

    Can anyone help please? Thanks

    Scott

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    @esmi

    Forum Moderator

    The best option would be to hid the title by pushing it off the screen but as you’ve removed it from the page, I can’t give the precise CSS that would achieve this.

    Hi Esmi, thanks for the prompt reply. Ok I added a short title to the page, ‘home’ and made it visible in navigation.

    I know my query is probably a bit odd – I can hide the title if I want but as I want google and other search engines to find me and see the H1 there must be a way to do both…

    Thanks

    Scott

    esmi

    @esmi

    Forum Moderator

    there must be a way to do both…

    Oh but there is – using the off screen positioning approach that I mentioned above. something like:

    #header .menu .page-item-37 {
    position:absolute;
    top:-9000px;
    left:-9000px;
    }

    should do the trick. That said, I don’t think you’d lose any Google juice by simply excluding the home page from the top navigation. You already have a home link (that even has rel=home) on your site title. The far bigger issue, in my opinion, is the lack of an H1 on the home page itself. If it was my site, I’d want a nice keyword rich H1 title on that Home page that could then be taken off screen by CSS.

    himanshu88

    @himanshu88

    Add this to header.php

    <?php if ( is_home() ) { ?>
    <h1 id=”h1off” style=”display:none;”><?php bloginfo(‘name’); ?></h1>
    <?php } else { ?>
    <?php
    }
    ?>

    Then add this to stylesheet ,

    #h1off {
    position:absolute;
    top:-9000px;
    left:-9000px;
    }

    divorceforums

    @divorceforums

    Thank you so much imanshu88. I have tried your method and it worked. I actually had to edit both files using Dreamweaver which was really easy then I loaded them back to my servers.

    Thank you again!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hiding page title while adding H1 tag to homepage’ is closed to new replies.
Skip to toolbar