Support » Plugins and Hacks » Yet Another Related Posts Plugin (YARPP) » limit related posts to specific category

  • Resolved philmetz

    (@philmetz)


    great plugin!

    I’m using YARPP several times within the same post.

    Each instance is intended to display related posts from a different category than the current post.

    What’s the simplest way to limit the related posts displayed in each instance to their specific category?

    (eg, the current post is for a category=shirt tag=blue,striped
    I’d like to display separate lists of blue striped shoes and blue striped pants beside the description of the shirt)

    thanks for any help

    http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The simplest way is probably to use a YARPP custom template: http://mitcho.com/blog/projects/yarpp-3-templates/

    When each post is considered, you can check the post and see if it’s in a category you want to display or not.

    thanks,

    I’ll consider the custom templates.

    At present I’m calling related_posts() in 4 instances within the content of every post. Are there any arguments that could be added to each related_posts() instance (independently) that would limit the results by specifying a single term in a custom taxonomy?
    I’d rather specify the term I desire than exclude the ones I don’t…

    thanks again!

    Unfortunately specifying just a particular term you require is not supported.

    If you’re more familiar with PHP, I suggest you try just using get_related() to get an array of post objects, and then sorting them however you want to (by category, for example) and then printing. This way is more performant, as only one related post query will be made. Hope that helps.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘limit related posts to specific category’ is closed to new replies.