Title: related posts question
Last modified: August 18, 2016

---

# related posts question

 *  [jinsan](https://wordpress.org/support/users/jinsan/)
 * (@jinsan)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/related-posts-question/)
 * I’ve tried two different plugin, but perhaps I don’t understand how it works.
   What I want is for the related posts plugin to display say, 5 random or previous
   entries from the category of the current post. So if the current entry is from
   WordPress category, then the related entries will be from the WordPress category
   be it random or in order, excluding the current entry.
 * Here’s my site: [http://sekhu.net/wp/](http://sekhu.net/wp/)
 * The entries should display in the bottom right hand side but I haven’t got this
   to work quite yet. It’s obviously trying and working, but not the way I need 
   it to.
 * Please advise.
 * Thanks in advance

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

 *  [Lorelle](https://wordpress.org/support/users/lorelle/)
 * (@lorelle)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/related-posts-question/#post-185415)
 * I use the following with the [Related Posts Plugin](http://www.w-a-s-a-b-i.com/):
 * `<ul>
    <li id="related"><?php _e('Related Articles'); ?> <ul><?php related_posts(
   10, 10, '<li>', '</li>', '', '', false, false); ?></ul></li>.......
 * Which gives me 10 random posts related to the keywords and titles of the post.
 *  Thread Starter [jinsan](https://wordpress.org/support/users/jinsan/)
 * (@jinsan)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/related-posts-question/#post-185416)
 * So do you have to enter the keyword yourself? I have a large amount of posts,
   and I don’t particuarly like the idea of going through each one to enter a keyword.
   Is it intelligent enough to read the current category and then say right it’s
   in category x so let’s pick out some random entries?
 * I’ll try your code in the meantime Lorelle. Cheers
 *  [davidchait](https://wordpress.org/support/users/davidchait/)
 * (@davidchait)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/related-posts-question/#post-185500)
 * CG-SameCat in my CG-PowerPack was designed to show posts from the same category
   as the current post — it was one of the ‘original related posts’ hacks. It just
   bases off the wp-cat, no other fields, no freetext searches, etc.
 * -d
 *  Thread Starter [jinsan](https://wordpress.org/support/users/jinsan/)
 * (@jinsan)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/related-posts-question/#post-185509)
 * Sounds good David, and where does one locate your plugins. have to say that’s
   the only reason I’ve never searched for your plugins, I never exactly knew where
   to get them from 🙂
 *  [davidchait](https://wordpress.org/support/users/davidchait/)
 * (@davidchait)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/related-posts-question/#post-185597)
 * CG-PowerPack is at [http://www.chait.net/index.php?p=238](http://www.chait.net/index.php?p=238)
 * Usage is something like this after the post:
    ` <?php if (function_exists('list_posts_of_cat')){
   $catp = list_posts_of_cat(get_the_category(), 3, 0, $post->ID); if ($catp) { 
   echo "<div>"; _e("Similar Posts:"); _e($catp); echo "</div>"; } } ?>
 * -d
 *  [jbbrwcky](https://wordpress.org/support/users/jbbrwcky/)
 * (@jbbrwcky)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/related-posts-question/#post-186156)
 * Hi david, tried your CG-samepost, kept giving me errors (using 1.5.1.3 WP).
 * WordPress database error: [You have an error in your SQL syntax. Check the manual
   that corresponds to your MySQL server version for the right syntax to use near‘
   AND post_date <= ‘2005-07-22 21:50:44’ ORDER BY post_stat]
    SELECT DISTINCT ID,
   post_title, post_name, post_status, post_date FROM wp_posts LEFT JOIN wp_post2cat
   ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND (category_id = 0) AND (post_status
   = ‘publish’ || post_status = ‘sticky’) AND ID != AND post_date <= ‘2005-07-22
   21:50:44’ ORDER BY post_status DESC, post_date DESC LIMIT 3
 *  [Beel](https://wordpress.org/support/users/beel/)
 * (@beel)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/related-posts-question/#post-186157)
 * Are you sure you set it up correctly, I just activated the samecat plugin, copied
   the code above just after the_content() and it ran fine from the get-go.
 *  [jbbrwcky](https://wordpress.org/support/users/jbbrwcky/)
 * (@jbbrwcky)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/related-posts-question/#post-186158)
 * Yeah, although I did put it in the sidebar (but it IS only activated when is_single()
   is checked). Would that have an effect?
 *  [Beel](https://wordpress.org/support/users/beel/)
 * (@beel)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/related-posts-question/#post-186159)
 * No it shouldn’t, the cause escapes me… I tested the code in my sidebar and added“&&
   is_single()”. It worked fine. David may have some suggestions.
 *  [davidchait](https://wordpress.org/support/users/davidchait/)
 * (@davidchait)
 * [20 years, 9 months ago](https://wordpress.org/support/topic/related-posts-question/#post-186161)
 * jbbr – I assume that’s with a recent CG-PowerPack version of CG-SameCat that 
   you are seeing the issue? I had at some point fixed an issue with compatability
   with .1.2 or .1.3 where they changed the category functions to return objects
   instead of arrays (or something like that).
 * If you’re having issues with latest&latest, lemme know, and I’ll try to take 
   a look this week.
 * -d

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

The topic ‘related posts question’ is closed to new replies.

## Tags

 * [CG-PowerPack](https://wordpress.org/support/topic-tag/cg-powerpack/)

 * 10 replies
 * 5 participants
 * Last reply from: [davidchait](https://wordpress.org/support/users/davidchait/)
 * Last activity: [20 years, 9 months ago](https://wordpress.org/support/topic/related-posts-question/#post-186161)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
