• Resolved Hardhat

    (@hardhat)


    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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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.

    https://stoneycreekwebdesign.com/contact.php

    dz

    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.

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

    Thread Starter Hardhat

    (@hardhat)

    Hi all

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

    Cheers for the input

    Hardhat

    Thread Starter Hardhat

    (@hardhat)

    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

    ??

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

    dz

    Thread Starter Hardhat

    (@hardhat)

    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

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Static homepage menu question’ is closed to new replies.