Support » Plugin: Yet Another Related Posts Plugin (YARPP) » [Plugin: Yet Another Related Posts Plugin] Post Type weight in related(ness) query

  • Resolved rfair404


    I don’t think that it’d be supported but as a new feature it’d be nice to be able to assign weights to post types much like assigning taxonomy weights to a custom relatedness query.

    For example:

    10 posts in post type ‘something_news’
    3 posts in post type ‘something_crossword_puzzles’
    5 posts in post type ‘something_classified_ads’

    if I do a relatedness query I can force a taxonomy, and weight a taxonomy, but I can’t weight a particular post type.

    in the above example if I’m looking for related posts to a ‘something_classified_ad’ it would make senese that I could weight the other posts in ‘something_classified_ads’ higher than posts in ‘something_crossword_puzzles’ even if the title, content word match or the taxonomies were matched.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hm, interesting. Unfortunately I have no plans to add such a feature to YARPP in the future.

    Technically you could do this with some custom code, filtering on YARPP’s internals, but that’s dangerous business and I wouldn’t recommend it.

    Mitcho, I appreciate the reply and understand that it may be a feature that isn’t in the road map. What would be a “safe” way to do this? Is there any documentation on how to filter YARPP’s “internals” in such a manner?

    I thought about this, and I think you can do it without messing with YARPP’s internals. The idea would be to just request 10 related something_news, then 3 something_crossword_puzzles and 5 something_classified_ads and then put these results together in your code and display them however you like.

    You can use get_related(null, array()) where the array() takes any arguments described in the “Developing with YARPP” section of the readme. In particular, you should be able to specify what post types you want returned. get_related will return an array of posts rather than print anything.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Yet Another Related Posts Plugin] Post Type weight in related(ness) query’ is closed to new replies.