Support » Fixing WordPress » Sidebar link to static homepage – problems

  • First day of testing WordPress 🙂

    Have setup a site at and installed the static-homepage plugin and edited home.php to give a customised homepage.

    I then modified sidebar.php to insert a direct link to the site root for the ‘Home’ link, and exclude the automatic link to the page it derives from, id #6 :

    <?php wp_list_pages('sort_column=menu_order&exclude=6&title_li=<h2>' . __('Navigate') . '</h2><a href="" title="Home">Home</a>'); ?>

    This has produced a couple of problems I can’t seem to fix:

    1. The homepage link is prefixed with a backslash “\” for some reason, and thus doesn’t work

    2. The homepage link sits outside of the list of the other pages, and doesn’t have the ‘>>’ prefix which the other page links do.

    If you look under ‘Navigate’ on the right at you should see what I mean…

    Any tips much appreciated, have trawled through already!



Viewing 15 replies - 16 through 30 (of 33 total)
  • paste the code are you using

    $pages = wp_list_pages('sort_column=menu_order&exclude=6&title_li=<h2>' . __('Navigate') . '</h2>

    <li><a href="./" title="Home">Home</a></li>
    echo stripslashes($pages);

    why aren’t you using :



    I’ve changed a bit in the code now:

    <?php wp_list_pages('sort_column=menu_order&title_li=<h2>' . __('Navigation') . '</h2> <ul><li><a href="./" title="Home">Home</a></li></ul>'); ?>

    And it works as intended now, except that the home link is formatted like this:

    Is it the <a href="./" title="Home"> that causes all the fuss?


    sure it was. the quote is causing all the mess. And you should check the plugin’s documentation. there is the fix.

    forgive me for asking, but what plugin? I’ve haven’t seen any link to a plugin. All I’ve seen is a codesnippet that adds a home link to the navigation.

    Niclas, read carefully the first two lines in the OP (original post) – it was about a plugin AND a homelink.
    So, if you are not using that plugin, start your own thread, otherwise people get confused (see above).

    This is the code that I used to get a “Home” link at the top of the pages list in the sidebar.
    Edit template-functions-post.php in the wp-includes directory.
    You will only need to edit one line. Not sure if this has already been posted by someone else yet. If so, please ignore.

    Somewhere around line 324:
    (Just change the URL to your address.)

    $output .= '<li class="pagenav">' . $r['title_li'] . '<ul> <li><a href="">Home</a></li>'; // Note: Forces "Home" link at top of pages list.

    thanks man! that did the trick.

    This is the best and simplest answer to create a home link in the sidebar. Thank you! I’ve been searching for a few hours now for a way to do this and the method outlined is the only solution which works perfectly and took, like, three second to implement. Wow.

    I read through a lot of posts by people asking for the “new to php” answer for this, so I’d like to add two helpful details. This is the exact path to the file you want to edit:

    Then just do a search for this line:
    $output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';

    and replace it with this line:
    $output .= '<li class="pagenav">' . $r['title_li'] . '<ul> <li><a href="/">Home</a></li>'; // Note: Forces "Home" link at top of pages list.

    If your wp installation is not run from your domain root, then replace the slash “/” with /yourWPdirectory

    Thanks again, dmetzcher.

    Hey I have a question, I’m not a php master or anything, but seem to do alright hacking together code.

    But I am a little confused, I want to use this method to put multiple links in the “menu, navigate” area but can’t see to get it to work. Also, I dont want to force it to the top, though Ic an’t figure out which peice of code is actually telling it to or why I can just make more then one link, I just figured copying nad pasting the link portion would do the trick, but it doesn’t.

    When I do the above, my website crashes with the above error and I have to reinstall wordpress to get back to normal. What am I doing wrong?

    Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/d4v/public_html/wp-includes/template-functions-post.php:570) in /home/d4v/public_html/wp-content/plugins/wordspew/wordspew.php on line 35

Viewing 15 replies - 16 through 30 (of 33 total)
  • The topic ‘Sidebar link to static homepage – problems’ is closed to new replies.