WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Static homepage menu question (8 posts)

  1. Hardhat
    Member
    Posted 7 years ago #

    Hi all

    I'm trying to use the 2.1+ static homepage option. here's what's happening...

    I've created a static page in WP - called 'Welcome' - that I want to use as my static homepage and have selected it as such under 'Options > Reading > Front page displays a * static homepage'

    It does in fact show as my site's homepage, but my main menu insists on also listing a 'Home' link as well as the 'Welcome' link.

    So, just to clarify, where I would expect to just see the 'Welcome' page as the first menu link, I first see a 'Home' link and then the 'Welcome' link directly below it. Both links show the content of the new 'Welcome' page.

    Simple question: how do I get rid of that 'Home' link?

    BTW: No: I haven't created a page called 'Home'.

    I hope this makes sense.

    Cheers

    Hardhat

    PS: I'm working offline in a MAMP install on my home Mac, so, unfortunately, can't show you the page online.

  2. dwzemens
    Member
    Posted 7 years ago #

    You are using a theme written before WordPress 2.1 and before the static homepage was available. So, the code in the file that writes your page links is simulating a link for a Home Page, probably with code similar to this:

    if (is_home() && !is_paged() )
    {echo('current_page_item');}
    else
    {echo('page_item');}?> ">
    ">Home

    You would find this code just above another WordPress function call, probably this:

    <?php wp_list_pages('sort_column=menu_order'); ?>

    So you need to remove the code mentioned first above. Then it will not duplicate the home page. The code is probably in the sidebar.php or header.php file, depending on if you have a top navigation display or the navigation is in the sidebar.

    Make sense?

    Feel free to contact me using my website contact form if you have other questions.

    http://stoneycreekwebdesign.com/contact.php

    dz

  3. Chris_K
    Member
    Posted 7 years ago #

    Feel free to contact me using my website contact form if you have other questions.

    Would prefer to keep the help conversations here to help folks who may have similar/same issues.

  4. dwzemens
    Member
    Posted 7 years ago #

    Sorry, HandySolo. I had every intention of reporting the full outcome here, but sometimes direct contact makes resolving the issue easier.

  5. Hardhat
    Member
    Posted 7 years ago #

    Hi all

    I'll dig around and let you know the outcome.

    Cheers for the input

    Hardhat

  6. Hardhat
    Member
    Posted 7 years ago #

    Hi all

    Nailed it!

    Just for clarity: I'm using a hacked about version of the Andreas Viklund theme WP-Andreas01.

    Although Andreas's theme features a sidebar, the code that dwzemens mentions is actually in the header.php file.

    In that file (and following d's instructions) the code I found was this:

    <h2 class="hide">Main menu:</h2>
    <ul class="page">
    <?php if (is_page()) { $highlight = "page_item"; } else {$highlight = "page_item current_page_item"; } ?>
    <li class="<?php echo $highlight; ?>"><a href="<?php bloginfo('url'); ?></a>">Home</li>
    <?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
    </ul>

    After trying a two options (php isn't my forté at the moment, but I'm getting there!) I removed the following:

    <li class="<?php echo $highlight; ?>"><a href="<?php bloginfo('url'); ?></a>">Home</li>

    In doing this I successfully removed the unneeded 'Home' link, but maintained the theme's ability to highlight the current active page in the menu using CSS.

    The only thing other folks may need to remember is that if, like me, you've worked up a number of different headers for different templates, but all are based on the theme's original header.php, then you obviously have to go in and do the same surgery on those to replicate the success of the fix across the site.

    And that's it.

    Although I consider this resolved I'll leave this open for a day or so to see if anyone has any further comments on the matter.

    But as I said: fixed :)

    Just a brief note to the continuing success of these support forums. I don't know there's anything similar with this regular successful depth of response.

    Long live WP!


    Hardhat

  7. dwzemens
    Member
    Posted 7 years ago #

    :-)

    Glad I could help - without support from people around the world I would never have known that answer.

    dz

  8. Hardhat
    Member
    Posted 7 years ago #

    d: couldn't agree more. :)

    I suppose the only thing I'd add before wrapping this up is that the possible issue with legacy themes not supporting static homepages without tweaking should be Codex'd.

    Just FYI

    Thanks all

    Hardhat

Topic Closed

This topic has been closed to new replies.

About this Topic