WordPress.org

Ready to get started?Download WordPress

Forums

In Single.php, I need sidebar to show menu for parent categories other posts (6 posts)

  1. grypesagon
    Member
    Posted 7 years ago #

    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 http://www.grypesagon.com/category/artwork/ 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.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

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

  3. grypesagon
    Member
    Posted 7 years ago #

    <!--- 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>
    	</div>
    
    <?php } elseif( is_single() ) { ?>
    
    <?php } elseif( is_404() ) { ?>
    <img src="<?php bloginfo('stylesheet_directory'); ?>/images/404.png" />
    
    	<?php endwhile; else: ?>
    	<?php endif; ?>
    
    <?php } ?>
  4. grypesagon
    Member
    Posted 7 years ago #

    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.

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

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

  6. grypesagon
    Member
    Posted 7 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags