Limiting number of levels

Forums Forums Menus Limiting number of levels

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #46
    Anonymous
    Member

    Hey great plugin Ryan. How can I limit the number of levels that pop out. ie. I have a page structure that is 3 levels deep but I don’t want to show the 3rd level in the drop down hover. I’m sure its pretty easy but I don’t want to mess with what I have without doing it properly. thanks in advance, cheers.

    #2160

    I know how to do this for pages, but not for categories, archives etc. You will need to use one of the sets of code below instead of the regular function in your theme to limit the level of dropdown displayed.

    Add &depth=x where x is the level of dropdown you want to appear for any page lists, ie: to display up to only the second level …
    [code:3b2qg2qy]<?php wp_list_pages(‘title_li=&depth=2’); ?>[/code:3b2qg2qy]

    suckerfish()

    [code:3b2qg2qy]<?php echo ‘
    <ul id="suckerfishnav">
    <li><a href="’ , bloginfo(‘url’) , ‘/">Home</a></li>
    <li><a href="#">Pages</a>
    <ul>’ , wp_list_pages(‘title_li=’) , ‘</ul>
    </li>
    <li><a href="#">Archives</a>
    <ul>’ , wp_get_archives() , ‘</ul>
    </li>
    <li><a href="#">Categories</a>
    <ul>’ , wp_list_categories(‘title_li=&exclude=10’) , ‘</ul>
    </li>
    <li><a href="#">Blogroll</a>
    <ul>’ , wp_list_bookmarks(‘title_li=&categorize=0’) , ‘</ul>
    </li>
    </ul>’;
    ?>[/code:3b2qg2qy]

    suckerfish1()

    [code:3b2qg2qy]<?php echo ‘
    <ul id="suckerfishnav">’ , wp_list_pages(‘title_li=’) , ‘</ul>’;
    ?>[/code:3b2qg2qy]

    suckerfish2()

    [code:3b2qg2qy]<?php echo ‘
    <ul id="suckerfishnav">
    <li><a href="’ , bloginfo(‘url’) , ‘/">Home</a></li>
    ‘ , wp_list_pages(‘title_li=’) , ‘
    </ul>’;
    ?>[/code:3b2qg2qy]

    suckerfish3()

    [code:3b2qg2qy]<?php echo ‘
    <ul id="suckerfishnav">
    <li><a href="#">Pages</a>
    <ul>’ , wp_list_pages(‘title_li=’) , ‘</ul>
    </li>
    <li><a href="#">Archives</a>
    <ul>’ , wp_get_archives() , ‘</ul>
    </li>
    <li><a href="#">Categories</a>
    <ul>’ , wp_list_categories(‘title_li=&exclude=10’) , ‘</ul>
    </li>
    <li><a href="#">Blogroll</a>
    <ul>’ , wp_list_bookmarks(‘title_li=&categorize=0’) , ‘</ul>
    </li>
    </ul>’;
    ?>[/code:3b2qg2qy]

    suckerfish4()

    [code:3b2qg2qy]<?php echo ‘
    <ul id="suckerfishnav">
    ‘ , wp_list_pages(‘title_li=’) , ‘
    <li><a href="#">Archives</a>
    <ul>’ , wp_get_archives() , ‘</ul>
    </li>
    <li><a href="#">Categories</a>
    <ul>’ , wp_list_categories(‘title_li=&exclude=10’) , ‘</ul>
    </li>
    </ul>’;
    ?>[/code:3b2qg2qy]

    suckerfish5()

    [code:3b2qg2qy]<?php echo ‘
    <ul id="suckerfishnav">
    <li><a href="’ , bloginfo(‘url’) , ‘/">Home</a></li>
    ‘ , wp_list_pages(‘title_li=’) , ‘
    <li><a href="#">Archives</a>
    <ul>’ , wp_get_archives() , ‘</ul>
    </li>
    <li><a href="#">Categories</a>
    <ul>’ , wp_list_categories(‘title_li=&exclude=10’) , ‘</ul>
    </li>
    </ul>’;
    ?>[/code:3b2qg2qy]

    #2161
    Anonymous
    Member

    oh man thats awesome, thanks. Did I tell you that you rock? Cause you do!

    #2162

    Lol, thanks William <img decoding=” title=”Smiley” />

    Let me know if it doesn’t work. I haven’t tested any of those codes and there’s always a possibility I made a mistake.

    #2163
    Anonymous
    Member

    THANKS! finally an solution

    #2164

    This is quite an old topic and is a little out of date now:

    You can do the same thing with categories with the following code:
    [code:1spth0gs]<?php wp_list_categories(‘title_li=&depth=3’); ?>[/code:1spth0gs]

    I’ll consider adding the ability to change the depth via the admin panel for a new version of the plugin. That way you would be able to modify the number of levels via the admin page instead of modifying the code itself.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.