WordPress.org

Ready to get started?Download WordPress

Forums

Yet Another Related Posts Plugin (YARPP)
[resolved] limit related posts to specific category (4 posts)

  1. philmetz
    Member
    Posted 1 year ago #

    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/

  2. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. philmetz
    Member
    Posted 1 year ago #

    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!

  4. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.