WordPress.org

Forums

Yet Another Related Posts Plugin (YARPP)
[resolved] Excluding post types using yarpp_map_post_types (4 posts)

  1. chadrew
    Member
    Posted 2 years ago #

    Hello,
    Can someone please give me an example of using yarpp_map_post_types filter to exclude or include certain post types in the "pool"?

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

  2. marcobarra
    Member
    Posted 2 years ago #

    have you found an answer to this yet chadrew? i'm interested in how i can assign my own custom post types.

  3. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    Hi all -- thanks for your interest in the yarpp_map_post_types filter!

    First things first: yarpp_map_post_types is only called for "automatic display" YARPP instances, thereby allowing you to override the settings in "the pool" options. If you are calling YARPP directly via PHP, you can manually specify post types. Information on this is in the "custom displays" section of the readme.

    Second things second: the structure of yarpp_map_post_types is that you must return a nonempty array with the post type names that should be considered. Within your yarpp_map_post_types function, you can consider whatever information from the context. In particular, at this point in execution the active post_ID has not been hijacked yet by YARPP, so you can do things like check the global $post object to see what the reference post is, and change what post types should be considered based on that.

    I hope that helps. Is there anything in particular you all are looking to accomplish?

  4. beckieb
    Member
    Posted 1 year ago #

    Can you please give an example of how to use the filter?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yet Another Related Posts Plugin (YARPP)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic