WordPress.org

Ready to get started?Download WordPress

Forums

Top menu doesn't reflect appearances->menu setup (9 posts)

  1. iamdeco
    Member
    Posted 4 years ago #

    Hi! I really hope someone can help, thanks in advance!

    I set up my menus through appearances->menu, and it works fine for my custom menu widget. However, the menus at the top of are all messed up, no order, duplicates, children... fun stuff.

    I originally had it set up on the wordpress.com site, and it worked fine there. See how it should look here: http://restartu.wordpress.com/

    Unfortunately, it now looks like this: http://iamdeco.com/

    I suspect I will be told to edit header.php
    If so, could you please provide what I need to add exactly, so that I can cut and paste? I have absolutely no idea how to made sense of the code, let alone do any editing.

    I am using the greyzed theme, if it matters.
    The existing code:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    THANK YOU!!

  2. Charles Frees-Melvin
    Member
    Posted 4 years ago #

    <?php wp_list_pages('sort_column=post_date&depth=1&title_li='); ?>

    This line is getting a list of Pages. You need to use wp_nav_menu to show a custom navigation as listed in http://codex.wordpress.org/Function_Reference/wp_nav_menu

  3. Charles Frees-Melvin
    Member
    Posted 4 years ago #

    Actually this whole section can be replaced:

    <div id="nav"><a href="<?php echo get_option('home'); ?>/">Home</a>
    <?php wp_list_pages('sort_column=post_date&depth=1&title_li='); ?>
    </div>
  4. iamdeco
    Member
    Posted 4 years ago #

    Thank you Thee!
    SO I will replace
    <div id="nav">

    * href="<?php echo get_option('home'); ?>/">Home

    <?php wp_list_pages('sort_column=post_date&depth=1&title_li='); ?>

    </div>
    with what you gave, correct?

    On a separate note, it seems my entire site is down. "problem loading page". Unnerving... What could be causing this??

  5. iamdeco
    Member
    Posted 4 years ago #

    Ok, so the site is back up (that was weird)
    I inserted the suggested code above, and the menu did change, but so did the formatting of it. So I put back in what was originally there, but the formatting is still messed up. I am very confused.
    check it out: iamdeco.com
    Thank you!

  6. Charles Frees-Melvin
    Member
    Posted 4 years ago #

    I seem to be missing what was reference in the linked documentation page. The correct usage would be:

    <?php wp_nav_pages('container_id=nav&depth=1'); ?>

    Based on the example code.

  7. Charles Frees-Melvin
    Member
    Posted 4 years ago #

    Correction:
    <?php wp_nav_menu('container_id=nav&depth=1'); ?>

  8. iamdeco
    Member
    Posted 4 years ago #

    I accidentally got it to work a little bit.
    I can't seem to get it to ignore parts that I bookend with /* and */
    I say this because when I put in your most recent suggestion I ended up with duplicate menus. I also had to simply remove the following line:

    /* href="<?php echo get_option('home'); ?>/">Home */

    What do I lose by removing that?

    The only thing missing is the drop down sub menus I had before... but ultimately, I'll live without that.

    Thank you so much for your help!
    Here is the final code I have working:

    <div id="page">
    <div id="nav">

    <?php wp_nav_menu('sort_column=post_date&depth=1&title_li='); ?>

    </div>

  9. Charles Frees-Melvin
    Member
    Posted 4 years ago #

    The part of the code depth=1& limits the menu to one layer, change value to 0 or remove it, I added it because your original code sample has depth=1

    The 1st piece of code you mentioned adds the Home link as the 1st menu item, I can be assumed you are going to add yourself in the admin.

    container_id=nav in the code I suggested creates the <div id="nav"> before and </div> after.

    sort_column=post_date was used by wp_list_pages to sort the page list by order created wp_nav_menu does not use it, therefore making it useless code.

    title_li= is also no longer used since the nav menus don't have a title.

    Sorry for being detailed but trying to teach you what the code does, that way you can decide how to cutomize to your needs.

Topic Closed

This topic has been closed to new replies.

About this Topic