WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Integrating second menu into single pages (3 posts)

  1. FuxiAdmin
    Member
    Posted 3 years ago #

    Hi

    I would like to integrate a vertical menu to sit at the left side of my posts, please view, http://www.fuximagazine.com/music/2010/05/17/lee-jung-hyun-meets-with-lady-gaga-to-plan-her-american-advance/

    In this menu I will include further subcategories to the available subcategories in the top horizontal menu. I have already created the menu in CSS, please view, http://fuximagazine.com/dev/commenu.html#

    This vertical menu is relative to the category that the post has been written for only.

    My current main menu is a widget, loaded through the header.php

    I have included this vertical menu in my single.php;

    <?php get_header(); ?>
    
    <div id="bigcolumn">
    
    <?php
    $post = $wp_query->post;
    if ( in_category('45') ) {
    include (TEMPLATEPATH . '/widgets/single2.html');
    } elseif ( in_category('8') ) {
    include (TEMPLATEPATH . '/widgets/single.html');
    } else { ?>
        <div id="singleleftcolumn"><?php $sec = 1; include TEMPLATEPATH. '/widgets/news_left.html'; ?></div>
        <div id="singlerightcolumn"><?php $sec = 2; include TEMPLATEPATH. '/widgets/single3.html'; ?></div>
    <?php
    }
    ?>
    
    <div class="clear"></div>
    </div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Does anybody know how I can integrate this new menu so that it is specific to the category that the post is in, e.g Film, Music... etc.

    Code for my horizontal menu is as follows,

    <div id="menu">
    
    	<?php if ($comfy['menu'] == true) : ?>
    	<ul>
    	<li<?php if(!is_category() && !is_page()) { ?> class="current-cat"<?php } ?>><a href="<?php bloginfo('home'); ?>/" title="Home"><?php print NAV_HOME; ?></a></li>
    	<?php wp_list_categories('orderby=ID&order=ASC&depth=2&hide_empty=0&title_li=&exclude='.$comfy['featured']); ?>
    	</ul>
    	<?php endif; ?>
    
    	<?php if ($comfy['search'] == true) : ?>
    	<form class="searchform" method="get" action="<?php bloginfo('url'); ?>/">
    		<fieldset>
    			<input type="text" value="<?php the_search_query(); ?>" name="s" class="searchfield" />
    			<input type="submit" value="" class="searchbutton" />
    		</fieldset>
    	</form>
    	<?php endif; ?>
    
    </div>

    Any help would be appreciated.

  2. FuxiAdmin
    Member
    Posted 3 years ago #

    Think I should re-word some of this. Does anybody know what I should change in the above menu php to target the 'child' and 'grandchild' categories, of a particular parent category?

  3. FuxiAdmin
    Member
    Posted 3 years ago #

    I'm starting to get somewhere, have managed to get a menu running down the left side, using the following code,

    <div id="fuximenu">
    	<ul>
    	<li><a href="<?php echo get_option('home'); ?>/" class="on">Home</a></li>
     	<?php wp_list_categories('orderby=name&exlude=181&title_li=');
     	$this_category = get_category($cat);
     	if (get_category_children($this_category->cat_ID) != "") {
     		echo "<ul>";
    	wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID);
     		echo "</ul>";
     	}
    	?>
    	</ul>
    	</div>

    Does anybody know what to change in the code so that it targets and only shows the child categories of a specific parent category?

Topic Closed

This topic has been closed to new replies.

About this Topic