• We all know that the pages menu is created dynamically – however I would like to add a ‘Home’ link to the top of the menu that is created – does anyone know how I could do this.

    Thankyou

Viewing 11 replies - 16 through 26 (of 26 total)
  • What about
    <h2>Pages</h2>
    <ul>
    <li><a href="<?php bloginfo('url'); ?>">Home</a></li>
    <?php wp_list_pages('title_li='); ?>
    </ul>

    If the CSS is the only problem now, it’s easy to fix.

    Of course, you could make a link category and add all the links you want to it, but it would require adding a new link every time you add a new page.

    My solution to this on my own page is this:
    <li>This site
    <ul>
    <li><a href="<?php bloginfo('url'); ?>">Home</a></li>
    <?php wp_list_pages('sort_column=menu_order&title_li='); ?>
    </ul>
    </li>

    Thread Starter ghecko

    (@ghecko)

    I have it all working now apart from the CSS

    I have the normal code and my code both showing – but as you can see the lines seperating the menu are missing from my code – thats my last issue now.

    For your info here is the standard code with the lines showing correctly
    <ul>
    <?php wp_list_pages('title_li=<h2>' . __('Pages') . '</h2>' ); ?>
    </ul>

    here is my code

    <h2>Navigation</h2>
    <li><a href="<?php bloginfo('url'); ?>">Home</a></li>
    <?php wp_list_pages('title_li'); ?>

    You never gave us your url ?? Anyway, the original code you pasted generates something like
    <ul>
    <li id="pagenav">
    <h2>Pages</h2>
    <ul>
    <li>Page one</li>
    <li>Page two</li>
    </ul>
    </li>
    </ul>

    With an empty title_li, wp_list_pages will only generate the li tags around each link so you have to fill in the rest:
    <ul>
    <li id="pagenav">
    <h2>Navigation</h2>
    <ul>
    <li><a href="<?php bloginfo('url'); ?>">Home</a></li>
    <?php wp_list_pages('title_li'); ?>
    </ul>
    </li>
    </ul>

    That should work CSS-wise too.

    One way is to check the source generated by the original code, paste it and only replace the page link <li>s with the wp_list_pages call. That way you can’t go wrong ??

    minna, I tried your method, and it works, except I can’t figure out how to style it right!

    Check it out here… https://www.trickmydorm.com

    The navigation list is indented too much. Anyone know how to fix this in the CSS?

    Hey, I replied to your email, but I’ll reply here too. It seems you’ve got everything fixed, or am I seeing things (or actually not seeing what I’m supposed to be seeing)?

    I’ve created a wp hack just for this problem. It creates “special pages” to link external resources. Quite simple, too. You can find it here.
    Cheers.

    Awesome Joox!
    Can you post the final code you used to get this to work?

    I can handle the css no prob, but I’m at the point that you were where my pages menu list looks like so:
    https://www.ragecg.com/bushido

    This is because my current code looks like this:

    <li><a href="<?php bloginfo('url'); ?>">Home</a></li>
    <?php wswwpx_fold_page_list ('sort_column=menu_order&title_li=<h2>' . __('MENU') . '</h2>' ); ?>

    Thanks for any help, and thanks to all of you (esspecialy you Minna!) for helping with this issue, as I will be needing it for another WP custom site I’ll be doing for a client next week:)

    NOTE: As you can see, I am using the “fold_page_list” plugin in the wp_list_pages string.
    It adds some new functions to the wp_list_pages one without hurting anything:)
    Works very well btw:)

    Thanks again!

    ragecg: I assume your problem is that Home is separated from the other links, right? That’s because the header “Menu” is added in the fold_page_list’s parametres. You can take it out (ending up with parametres 'sort_column=menu_order&title_li=') and “hard code” it right above the Home link (as <h2>__('MENU')</h2>, or just <h2>MENU</h2> without “localization function” (__('some text')).

    Thanks Minna! I will try tonight after work!

    Rock on! It worked. I bow to you!!

    Thanks much! Now onto the css….

    Thanks again all!

    Forgive me ahead of time, WP sensei’s…all I’m trying to do is add a bunch of pages to my sidebar without having them defaulting under the stooooopid “Pages” heading. I need 10 different categories, some with a children, some with not. All need to be links that bring up that page’s content that can be added and modified as needed.

    I assume this cannot be done through the “write page” option in the dash board; I don’t mind doing things by hand inside the sidebar php file; I just want to know if there is an easier way to automate this.

    Thank you,

    Rob

Viewing 11 replies - 16 through 26 (of 26 total)
  • The topic ‘Add Static links To Pages Menu’ is closed to new replies.