WordPress.org

Ready to get started?Download WordPress

Forums

Yet Another Related Posts Plugin (YARPP)
[resolved] [Plugin: Yet Another Related Posts Plugin] Post Type weight in related(ness) query (4 posts)

  1. rfair404
    Member
    Posted 1 year ago #

    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.

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

  2. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. rfair404
    Member
    Posted 1 year ago #

    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?

  4. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic