Title: SingleCat plugin
Last modified: August 19, 2016

---

# SingleCat plugin

 *  [lenaluna](https://wordpress.org/support/users/lenaluna/)
 * (@lenaluna)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/singlecat-plugin/)
 * I installed SingleCat plugin to be able to insert posts in a page.
    It is working
   brilliantly, but it always inserts the posts at the top of the page. I would 
   like to be able to have an intro and then put the singlecat shortcode as I tried
   in my page:
 * bla bla bla intro
    `[singlecat cat=23 level=private posts=10]`
 * thanx much

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

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/singlecat-plugin/#post-1051860)
 * Might also look at [http://wordpress.org/extend/plugins/list-category-posts/](http://wordpress.org/extend/plugins/list-category-posts/)
 *  [zacnboat](https://wordpress.org/support/users/zacnboat/)
 * (@zacnboat)
 * [17 years ago](https://wordpress.org/support/topic/singlecat-plugin/#post-1051984)
 * I’m have this same exact issue, and don’t see a resolution on here.
 * It looks like it’s been a month. Does the creator not monitor queries here?
 * MichaelH, that’s a great tool, but it doesn’t allow for the display of the complete
   post, just a list.
 * I too want the five most recent complete posts from a specific category to be
   display below an introduction. This thing is aweseome, except the posts all show
   up above my other content on the page.
 *  [kojisin](https://wordpress.org/support/users/kojisin/)
 * (@kojisin)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/singlecat-plugin/#post-1052020)
 * i came across the same problem.
 * i believe the problem is, this plug doesn’t follow the rule below.
    [http://codex.wordpress.org/Shortcode_API#Output](http://codex.wordpress.org/Shortcode_API#Output)
 * following is a rubbish maybe, but works for me.
 *     ```
       --- singlecat/singlecat.php.orig        2009-10-06 21:46:00.000000000 +0900
       +++ singlecat/singlecat.php     2009-10-07 02:05:26.000000000 +0900
       @@ -11,12 +11,14 @@
        //Actions
        add_shortcode('singlecat', 'sc_shortcode');
   
       +
        function sc_shortcode($attr) {
   
            $level = $attr['view'];
            $cat = $attr['cat'];
            $posts = $attr['posts'];
            $view = 0;
       +    $output = "";
   
            if($level != "public" && $level != "private"):
                $level = "private";
       @@ -41,31 +43,31 @@
              $wp_query= null;
              $wp_query = new WP_Query();
              $wp_query->query('category_name='.$catname->name.'&showposts='.$posts.'&paged='.$paged);
       -
       -      while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
       +
       +      while ($wp_query->have_posts()) : $wp_query->the_post();
       +        $output .= '
   
                <div class="post">
   
       -          <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
       +          <h2><a href="'.apply_filters('the_permalink', get_permalink()).'">'.get_the_title().'</a></h2>
   
       -          <small><?php the_time('F jS, Y'); ?></small>
       +          <small>'.apply_filters('the_time', get_the_time( 'F jS, Y' ), 'F jS, Y').'</small>
   
                  <div class="entry">
       -            <?php the_content(); ?>
       +            '.str_replace(']]>', ']]>', apply_filters('the_content', get_the_content())).'
                  </div>
   
       -          <p class="postmetadata">Posted in <?php the_category(', '); ?></p>
       -
       -        </div>
       +        </div>';
   
       -      <?php endwhile; ?>
       +      endwhile;
   
       +      $output .= '
              <div class="navigation">
       -        <div class="alignleft"><?php previous_posts_link('&laquo; Previous') ?></div>
       -        <div class="alignright"><?php next_posts_link('More &raquo;') ?></div>
       -      </div>
       +        <div class="alignleft">'._adjacent_post_link('&laquo; Previous', '%title', false, '', true).'</div>
       +        <div class="alignright">'._adjacent_post_link('More &raquo;', '%title', false, '', false).'</div>
       +      </div>';
   
       -      <?php $wp_query = null; $wp_query = $temp;
       +      $wp_query = null; $wp_query = $temp;
   
            else:
   
       @@ -73,6 +75,37 @@
   
            endif;
   
       +    return $output;
       +}
       +
       +
       +// import from wp-includes/link-template.php
       +function _adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) {
       +        if ( $previous && is_attachment() )
       +                $post = & get_post($GLOBALS['post']->post_parent);
       +        else
       +                $post = get_adjacent_post($in_same_cat, $excluded_categories, $previous);
       +
       +        if ( !$post )
       +                return;
       +
       +        $title = $post->post_title;
       +
       +        if ( empty($post->post_title) )
       +                $title = $previous ? __('Previous Post') : __('Next Post');
       +
       +        $title = apply_filters('the_title', $title, $post);
       +        $date = mysql2date(get_option('date_format'), $post->post_date);
       +
       +        $string = '<a href="'.get_permalink($post).'">';
       +        $link = str_replace('%title', $title, $link);
       +        $link = str_replace('%date', $date, $link);
       +        $link = $string . $link . '</a>';
       +
       +        $format = str_replace('%link', $link, $format);
       +
       +        $adjacent = $previous ? 'previous' : 'next';
       +        return apply_filters( "{$adjacent}_post_link", $format, $link );
        }
       ```
   

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

The topic ‘SingleCat plugin’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [page](https://wordpress.org/support/topic-tag/page/)
 * [post](https://wordpress.org/support/topic-tag/post/)

 * 3 replies
 * 4 participants
 * Last reply from: [kojisin](https://wordpress.org/support/users/kojisin/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/singlecat-plugin/#post-1052020)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
