Support » Fixing WordPress » Static Front Page solution

  • Resolved okpeery


    Here is what I did that seems to work, though I’m not sure my code modifications were up to standards.

    I set my static front page to a page I already created.

    I created a new page called blog and put nothing on it.

    I set the posts page to be this new blog page.

    The problem this left was that I had renamed the original home page blog in the code in the header file. I now had 2 blog items in my menu.

    I opened the header file and just deleted the “blog” from the first part of the menu, the code is there but it is blank, it doesn’t show in the menu and the other blog page I had just created houses the blog and it displays as I would like.

    I don’t know PHP well enough to know how much to delete without affecting other functions. Could someone look at the code below and let me know what to do to really clean it up?

    <div id="nav">
    <li class="<?php if (((is_home()) && !(is_paged())) or (is_archive()) or (is_single()) or (is_paged()) or (is_search())) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php echo get_settings('home'); ?>"><strong>ITUSEDTOSAYBLOGHERE</strong><?php echo $langblog;?></a></li>
    <?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thanks, okpeery, I had the same issue – i.e. when I’d set up a static front page the Blog link looped back to the static page – the blog had ‘gone’ or ‘stopped working’, however when I changed the static page setting back to the blog everything worked fine. A couple of seconds editing and it was solved using the above (only after hours of searching and trying various ‘solutions’). As ever, simplest is best. Thanks again.

    I think its the ‘wp_list_pages‘ function call in the code you show that really needs to change. There is a parameter called ‘exclude’ which lets you list the page ID numbers to not show. And in v2.7 there is also ‘exclude_tree’ (hide the specified page and all its sub-pages). but I don’t know where v2.7 has hidden the page IDs (you have to right-click on the list of page names and select ‘Properties’ and then you’ll see the URL ending in ‘post=xxx’ — how convoluted is that!?!)

    Why WordPress 2.7 doesn’t do this automatically is beyond me (especially since the Settings->Reading tab lets you specify which page is your static page; and which page is your blog page).

    Perhaps the brand new ‘wp_page_menu‘ should be used instead?


    Well, for the subsidiary problem raised by AndrewRH there is a neat plugin “Simply SHow IDs” which does just that.

    As for the lost front page / empty blog page. I’m still wandering about like a drunk sailor trying to get that to work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Static Front Page solution’ is closed to new replies.