WordPress.org

Ready to get started?Download WordPress

Forums

Hiding page title while adding H1 tag to homepage (6 posts)

  1. scottfoley
    Member
    Posted 3 years ago #

    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

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    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.

  3. scottfoley
    Member
    Posted 3 years ago #

    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

  4. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    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.

  5. himanshu88
    Member
    Posted 2 years ago #

    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;
    }

  6. divorceforums
    Member
    Posted 2 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic