WordPress.org

Ready to get started?Download WordPress

Forums

Nav bar pages issue in my theme (9 posts)

  1. richardpd
    Member
    Posted 4 years ago #

    Hi
    I have a problem with pages not displaying well in my top nav bar/menu
    in my own WP theme and would appreciate help to fix it.

    My theme is at chessat.richard-dickinson.com/

    My code is:

    <nav>
            	  <ul>
                <li><a href="<?php echo get_settings('home'); ?>">HOME</a></li>
    <?php wp_page_menu(); ?>
    
             </ul>
          </nav>

    I am most grateful for helpful advice so I can get my site pages to be displayed properly in the nav bar.I look forward to some reply.
    Many thanks

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    I think the first issue is your use of trying to include a home link, and wp_page_menu

    I'm not totally sure, as I haven't messed with the new menu system a lot....but I no longer include a home in with wp_nav_menu

    The point of the new menu system is so the user can create flexible menus. So the user is able to add their own home tab. No need to code it in like you've done......

    I tend to steal a lot of code from default WP themes when I'm learning stuff..... in the twentyten theme, functions.php, there is a snippet of code that will add a home tab to the nav menu when the default page menu is used (ie, if no custom menu is set up)

    I think if you deal with the home tab issue, that will get everything on one line, then we would be able to check out alignment a bit better

    Also, I don't think you need to wrap the whole menu in <ul> as that happens automatically....

    <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>

    for instance here is my menu code (wrapped in a nav div like yours) but that's all I have, taken from twentyten theme, it automatically outputs appropriate <ul> and <li> tags

  3. keesiemeijer
    moderator
    Posted 4 years ago #

    Do you use a plugin for the menu? Try deactivating and see what happens

  4. richardpd
    Member
    Posted 4 years ago #

    Hi
    Thanks for your replies.I agree I should not have the Home link hardcoded there and removed it but no matter what code I use I cannot gat a plain navbar with page links to display properly.
    What am I doing wrong & how can I fix this?

    I shall continue editing this myself but am struggling with it so
    I am grateful for some more help to get a navbar working for my theme.
    I would really appreciate this and again look forward to some more advice on this.Thanks

  5. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    What I did, is grab an exact copy of the nav_menu code from the twentyten theme and an exact copy of the menu css from the same theme, dropped it into my theme and it worked perfectly. Then I styled from there

  6. richardpd
    Member
    Posted 4 years ago #

    Thanks RVoodoo
    I am looking at TwentyTen & will see if I can use it to get my nav bar going properly!
    If not I may ask for help again ! :-)

  7. richardpd
    Member
    Posted 4 years ago #

    Hi
    I have spent the majority of today trying unsuccesfully to get this nav bar issue fixed. I appear to have gone backwards in development in the process as my intro section image & page background image are now not displaying! I tried using full address references for image sources but to no avail!

    My somewhat basic & hapless theme (but it is based on html5...)can be seen on onlinewpthemetest (My WP onlinethemetestblog site).

    I had to take it off my active chess blog at http://www.chessat.richard-dickinson.com and I have a free theme in place there for now.
    The navbar does not display site pages properly as tested on my full chess blog but this is not seen/does not show on my theme test blog site.

    A few days ago I thought I was quite close to having a functioning theme but after still struggling with it today I am not so sure now.
    So again I would really appreciate some more help to get this new theme of mine fixed and working satisfactorily. I look forward to some reply, many thanks

  8. richardpd
    Member
    Posted 4 years ago #

    Update:
    I am making some progress fixing my theme.
    I restored page background image and header image.

    However the nav menu bar background image shows in IE8 but doesn't show in Firefox?
    I cannot understand why not at the moment. Can someone please have a look and suggest what I need to do to fix this please?

    onlinewpthemetest

    I am very grateful for helpful replies, many thanks

  9. richardpd
    Member
    Posted 4 years ago #

    Update-
    I did use TwentyTen theme for guidance & have a much better nav bar showing site pages now.

    This is the wp php code I use to add my homepage as a navbar link
    <?php wp_page_menu('show_home=Home&menu_class=page-nav'); ?>
    Thanks to Justin Tadlock at justintadlock.com

    Twenty Ten uses the code below but I haven't edited that to add show the homepage & currently I am using Justin's WP2.7 code!

    <?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu.  The menu assiged to the primary position is the one used.  If none is assigned, the menu with the lowest ID is used.  */ ?>
    <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>

    Perhaps this code can be edited to add 'show home'?

    Anyway my nav bar is quite a bit better now-see
    ChessatmyboarD

    It has taken quite a while for me to get to this stage!
    Now I go onwards with WordPress!! :-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags