• Greetings,

    This has to be an easy solution, but I have tried everywhere and can not knit together each aspect.

    I would like to have posts excerpts from a single category load into my sidebar. I would love to be able to use the <–read more–> within the posts to dictate the output in the sidebar. When the read more is clicked the entire post should load into the single.php format.

    Below is code that I am using in my index page for a different category on the home (index) page. It works great. I wish I could understand it so I could just copy and paste and adjust.. LOL

    <?php if (have_posts()) : ?>
    <?php
    if (is_home()) {
    query_posts(“cat=-21”);}?>
    <?php while (have_posts()) : the_post(); ?>
    <div class=”entry”>
    <div class=”post” id=”post-<?php the_ID(); ?>”>
    ” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?>
    <?php the_content(‘Read more…’); ?>
    </div>
    </div>
    <?php endwhile; ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • I believe what you are looking for is very similar to what you already have in your index.php file.

    You can try this:

    <?php if(is_home()) {
      query_posts("cat=123"); /* cat=# is the category ID of the "featured" category */
      if (have_posts()) : while (have_posts()) : the_post();
    
        static $count = 0;
        if ($count == "3") { break; }
        /* The count == "3" is the maximum posts to display */
        else { ?>
    
        <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
          <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link to'); ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
          <div class="post-details">
            <?php _e('by '); ?><?php the_author() ?><?php _e(' on ');?><?php the_time('M j, Y') ?><br />
          </div> <!-- .post-details -->
          <?php the_content(__('Read more... ')); ?>
        </div> <!-- .post #post-ID -->
    
        <?php $count++; }
    
        endwhile;
    
      else : ?>
    
    	<p><?php _e('Yes, we have no bananas ... or posts ... today.'); ?></p>
    
    <?php endif;
    } ?>

    … its from a plugin I am developing.

    The plugin is complete … thanks for the idea!

    Look for BNS Featured Category … soon-ish. Just waiting for the powers that be to approve SVN space.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Category List in Sidebar with Exerpt’ is closed to new replies.