ThemeShaper Forums » Thematic


Two-Tiered Conditional Navigation

(5 posts)
  • Started 11 years ago by tdzl
  • Latest reply from tdzl
  • This topic is resolved
  1. I'm trying to implement this tutorial for a two tier conditional navigation, but having some problems. I assume I have to filter out the superfish navigation to make it work. Can somebody please help me write the proper code for functions.php to make this work?

    Any help would be much appreciated.

    Posted 11 years ago #
  2. Update:

    Here's my functions.php code:

    function remove_sfmenu () {
    add_action('init', 'remove_sfmenu');
    function remove_wp_page_menu() {
    function child_nav() {
    	<ul id="nav">
    	<?php wp_list_pages('title_li=&depth=1'); ?>  
    	<?php if($post->post_parent)
    	$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else
    	$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");  
    	if ($children && is_page()) { ?>
    	<ul id="subnav">
    	<?php echo $children; ?>  
    	<?php } else { ?>
    	<?php } ?>
    add_action('thematic_access', 'child_nav');
    function child_menuclass($ulclass) {
    return preg_replace('/
    <ul>/', '<ul id="nav">', $ulclass, 1);

    Here's the result.

    As you can see, the sub menu is displaying all child pages regardless of the parent page, and does not change as it's supposed to.

    Any ideas what I'm missing here?

    Posted 11 years ago #
  3. Hi tdzl,

    Remove all of those functions and replace them with these:

    function remove_thematic_access() {
    function child_nav() {
    	global $post;	?>
    	    <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><!-- .skip-link -->
    	    	<ul id="nav">
    		<?php wp_list_pages('title_li=&depth=1' ); ?>
    		<?php if( $post->post_parent )
    			$children = wp_list_pages( "title_li=&child_of=".$post->post_parent."&echo=0" ); else
    			$children = wp_list_pages( "title_li=&child_of=".$post->ID."&echo=0" );
    			if ($children && is_page()) { ?>
    			<ul id="subnav">
    		<?php echo $children; ?>
    		<?php } else {
    	} ?>
    		</div><!-- #access -->
    <?php }
    add_action('thematic_header', 'child_nav',9);


    Posted 11 years ago #
  4. Awesome, it worked! I had to edit the CSS a little to get the subnav on the 2nd line, but that was easy enough.

    Thanks, Gene!

    Posted 11 years ago #
  5. Question: What if I wanted to add child-pages of the blog for 'categories' and 'archives'. Nothing I've tried works. Any help would be greatly appreciated!

    Posted 11 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.