ThemeShaper Forums » Thematic

[closed]

How do you limit menu depth?

(9 posts)
  • Started 4 years ago by jasonelston
  • Latest reply from roycreative
  • This topic is not resolved
  1. jasonelston
    Member

    Hi, apologies if this question has been answered. I've search but couldn't find a resolution, or whatever discussed was beyond my technical capability.

    Is there a way to restrict the depth of the menu in Thematic. I only want to show the pages under the parent pages, not the next page down.

    About (Y)
    --Blah page (Y)
    ----Blah page (N)

    I guess this means I just want to show two levels.

    Thanks in advance.

    Jason

    Posted 4 years ago #
  2. Hi Jason. Try putting this in your child theme functions.php file:

    //  Add a dynamic menu using wp_list_pages
    
    function childtheme_menu() { ?>
         <div class="menu">
              <ul class="sf-menu">
                    <?php wp_list_pages('title_li=&depth=2'); ?>
              </ul>
         </div>
    <?php }
    
    add_action('wp_page_menu','childtheme_menu');

    The WordPress codex for this function is here: http://codex.wordpress.org/Template_Tags/wp_list_pages.

    I wrote a post about filter functions for the menu on my site: http://wordpresstheming.com/2009/11/filter-menus-in-thematic/

    Posted 4 years ago #
  3. jasonelston
    Member

    Hi Devin,

    Thanks for the info. Worked like a charm!

    Jason

    Posted 4 years ago #
  4. buzztone
    Member

    Hi Devin

    I found your Filter Menus in Thematic extremely helpful. Also
    Useful Thematic Filters
    was great. Agree that "the learning curve on Thematic is a bit steep if you’ve never used filters and hooks before". Please keep them coming.

    Neil

    Posted 4 years ago #
  5. I have this code in my functions.php file

    // We will build our custom menu first
    
    	// Remove the default Thematic Access
    	function remove_thematic_actions() {
    		remove_action('thematic_header','thematic_access',9);
    	}
    	add_action('init','remove_thematic_actions');
    
    	// Recreate the Thematic Access with menu-primary and menu-secondary
    	function childtheme_page_menu() { ?>
    		<div id="access">
    			<div class="skip-link">
    				<a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>"><?php _e('Skip to content', 'thematic'); ?></a>
    			</div>
    			<?php wp_page_menu('show_home=1&exclude=36,37,39,41,44,46,48&menu_class=menu menu-primary'); ?>
    			<div class="menu menu-secondary">
    				<ul>
    					<!--<?php wp_list_pages('title_li=&include=36,37'); ?> Can be removed from here -->
    				</ul>
    			</div>
    		</div>
    	<?php }
    	add_action('thematic_header','childtheme_page_menu','9');
    
    	// Add a drop down sub menu
    	function childtheme_category_menu() { ?>
    		<div id="category-access">
    			<div id="category-menu" class="menu">
    				<div class="menu-title"><?php _e('', 'thematic'); ?></div>
    				<ul id="category-nav" class="sf-menu">
    					<?php wp_list_pages('include=36,37,39,48&title_li=&depth=2'); ?>
    				</ul>
    			</div>
    		</div>
    	<?php }
    	add_action('thematic_belowheader','childtheme_category_menu', 5);

    The problem is that wp_list_pages is not generating nested lists. Specifying the depth argument has no effect on it.
    Any ideas what might be interfering?

    P.S. - First day with Thematic

    Posted 4 years ago #
  6. any updates?

    Posted 4 years ago #
  7. Have you looked at the source code to see if the list depth is there but CSS is hiding it somehow?

    Posted 4 years ago #
  8. Its not even generated. Anyways I got it working by custom php code through IDs

    Posted 4 years ago #
  9. I want to prevent pages with a parent category from showing up in my navigation. In a normal theme, I would just put this in the header.

    <?php wp_list_pages(depth=1); ?>

    I guess I have yet to understand why Thematic doesn't give us the same access to that code. This is not easier.

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.