Support » Themes and Templates » In Single.php, I need sidebar to show menu for parent categories other posts

  • I’ve tried to search for this and haven’t found much. The terms around this are just too generic and generate tons of unrelated threads. So sorry if I am repeating something that’s been addressed.

    If you go to you’ll see that it’s the category description with a menu listing the posts within that category on the right hand side in the sidebar.

    If you click on any of those items it takes you to a page with thumbnails and such.

    I already have the sidebar doing different things based on what type of page it’s on.

    I need to know how to code it so that when in single.php it will list the same menu it shows when viewing the parent catergory.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Without seeing the code generating that menu, it’s hard to say what you need to change.

    <!--- sidebar menu manager --->
    <?php if( is_category() ) { ?>
    	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<div class="sidepost" id="post-<?php the_ID(); ?>">
    	<p class="info"<small><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><b><?php the_title(); ?></b></a></small></p>
    <?php } elseif( is_single() ) { ?>
    <?php } elseif( is_404() ) { ?>
    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/404.png" />
    	<?php endwhile; else: ?>
    	<?php endif; ?>
    <?php } ?>

    so I’m looking to populate the <?php } elseif( is_single() ) { ?> section with whatever it would take to get a similar menu of the other posts within the category of the post being viewed.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Posts can belong to more than one category. How do you want to handle that?

    That won’t come up here. I’m using it as a website and not at all as a blog. I keep everything very segmented.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘In Single.php, I need sidebar to show menu for parent categories other posts’ is closed to new replies.