Title: sidebar posts
Last modified: August 19, 2016

---

# sidebar posts

 *  Resolved [carlos-campo](https://wordpress.org/support/users/carlos-campo/)
 * (@carlos-campo)
 * [17 years ago](https://wordpress.org/support/topic/sidebar-posts-2/)
 * I am developing a theme with posts in the right sidebar under category ‘SIDEBAR’.
   The sidebar posts show an image and a short desription followed by the <!–more–
   > insert.
    The main posts are under category ‘CENTRE’ and also use the <!–more–
   > insert. Unfortunately If I click to read a centre post, or sidebar post (single.
   php) the sidebar posts now display the complete contents. How can I stop this
   from happening
 * main pages:
    <?php query_posts(‘category_name=centre’); php if (have_posts()):
   php while (have_posts()) : the_post(); ?>
 * stuff here
 * <?php endforeach; else: ?>
    <p><?php _e(‘Sorry, no posts matched your criteria.’);?
   ></p> <?php endif; ?>
 * Sidebar:
    <?php query_posts(‘category_name=sidebar’); php if (have_posts()) :
   php while (have_posts()) : the_post(); ?>
 * stuff here
 * <?php endforeach; else: ?>
    <p><?php _e(‘Sorry, no posts matched your criteria.’);?
   ></p> <?php endif; ?>
 * Thanx

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [stvwlf](https://wordpress.org/support/users/stvwlf/)
 * (@stvwlf)
 * [17 years ago](https://wordpress.org/support/topic/sidebar-posts-2/#post-1073623)
 * Hi
 * I worked this out the other day
 * **using the more tag on a page or in the sidebar**
 *     ```
       <?php
       global $more;
       $sidebar = new WP_Query();
       $sidebar->query('category_name=sidebar');
       while ($sidebar->have_posts()) : $sidebar->the_post();
          $more = false;   // set $more to false to only get the first part of the post ?>
          <p><?php the_content('Read the rest...'); ?></p>
       <?php endwhile;
       $more = true;   // restore default $more behavior
       ?>
       ```
   
 *  Thread Starter [carlos-campo](https://wordpress.org/support/users/carlos-campo/)
 * (@carlos-campo)
 * [17 years ago](https://wordpress.org/support/topic/sidebar-posts-2/#post-1073672)
 * Hey stvwlf,
    thanks for the prompt reply and thanks heaps the code above which
   works just great. I believe WP can do anything if one has the support of this
   forum. Again.. thanks Carlos

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘sidebar posts’ is closed to new replies.

## Tags

 * [sidebar-posts](https://wordpress.org/support/topic-tag/sidebar-posts/)

 * 2 replies
 * 2 participants
 * Last reply from: [carlos-campo](https://wordpress.org/support/users/carlos-campo/)
 * Last activity: [17 years ago](https://wordpress.org/support/topic/sidebar-posts-2/#post-1073672)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
