• Sculley

    (@sculley)


    I’m a beginner to intermediate WP programmer. I’m trying to figure out how to do a simple drop down menu with nav that uses pages. I did drop downs on this blog that uses categories for the nav with just this code (no plugin):

    <ul id="nav_menu">
       <li><a href="<?php echo get_settings('home'); ?>">Home</a></li>
       <?php wp_list_pages('include=2&title_li=&depth=1');?>
       <?php wp_list_categories('include=472,471,470,469,468,467,466,465,464,463,462,333,310,300,299,293,292,291,290,289,288,287,286,285,284,283,282,280,279,278,277,276,275,274,273,272,271,270,269,254,248,249,180,279,251,252,253,266,267,268,167&title_li=&depth=2');?>
       <?php wp_list_pages('include=2308&title_li=&depth=1');?>
    </ul>

    I’m trying to do the same for this blog that uses mostly pages for the nav and thought it would be similar, however, can’t get it to work. Here’s what I tried testing one item – the second one down (#2 is parent):

    <ul id="nav_menu">    
    
    <?php wp_list_pages('include=3&title_li=&depth=1');?>
    <?php wp_list_pages('include=2,896,898,903&title_li=&depth=2');?>
    <?php wp_list_pages('include=23&title_li=&depth=1');?>
    <?php wp_list_pages('include=25&title_li=&depth=1');?>
    <?php wp_list_pages('include=27&title_li=&depth=1');?>
    <?php wp_list_categories('include=3&title_li=&depth=2');?>
    <?php wp_list_pages('include=407&title_li=&depth=1');?>
                </ul>

    I set up the pages so that the main nav (ID2) is a parent page and the drop downs are children but still won’t work.

    Thanks for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael

    (@alchymyth)

    the dropdown is facilitated by the corresponding css styles, which are not present in the non-working example.

    try to copy all the #nav_menu css styles from the working blog’s style.css (quite towards the end, starting with `/**************************** Navi *********************************/
    `)
    into the non-working blog’s style.css.

    you may need to make minor adjustments to match the design.

    Thread Starter Sculley

    (@sculley)

    Thanks alchmyth. I tried that and the drop downs still didn’t display. Is my code correct above?

    Thread Starter Sculley

    (@sculley)

    Just got it. I copied the CSS from my other site and then changed the php. Here’s the code in case someone else is trying to figure it out:

    <div id=”navbar_menu”>
    <ul id=”nav_menu”>

    • <?php wp_list_pages(‘include=3&title_li=&depth=2’);?>
    • <?php wp_list_pages(‘include=2,896,898,903&title_li=&depth=2’);?>
    • <?php wp_list_pages(‘include=23&title_li=&depth=2’);?>
    • <?php wp_list_pages(‘include=25&title_li=&depth=2’);?>
    • <?php wp_list_pages(‘include=27&title_li=&depth=2’);?>
    • <?php wp_list_categories(‘include=3&title_li=&depth=2’);?>
    • <?php wp_list_pages(‘include=407&title_li=&depth=2’);?>
    • </div>

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Drop downs’ is closed to new replies.