WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Possible to filter results based on post category

[Resolved] Possible to filter results based on post category

  • I’d like to create a YARPP template that restricts/filters the results so that only posts in the same category as the current post are returned. (Note: I’d like to continue to use the other relatedness options like tags and body set in the admin panel.)

    Is this possible? And if so, how?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Unfortunately there’s no good way right now to get information on what post is actually being displayed (and thus what the category you want to target is) from within the YARPP template.

    If you call related_posts() yourself, you could do something tricky like storing what category you want to target, based on the current post, in a global variable before you call related_posts(), then reference that global variable in the YARPP template.

    Mitcho, thanks for the response. Sounds doable, particularly since I’ll be calling related_posts() myself in most cases.

    Great!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Possible to filter results based on post category’ is closed to new replies.