WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Yet Another Related Posts Plugin] Feature request - disable on a per post basis (4 posts)

  1. phototristan
    Member
    Posted 4 years ago #

    I'd really like the ability to disable related posts on a per post basis when composing a post.

  2. @phototristan - this can be done in your theme... just look for some particular metadata and execute related_posts() if that data is there, and don't execute it if it isn't there... that way you can switch it on and off.

  3. willard97
    Member
    Posted 4 years ago #

    Just found this and I'm not really clear on what you're saying.

    Where is this metadata located in the theme? I just want to disable on a specific post, not on the rest of the site.

    Will it work by setting up a custom field with a false value?

    I tried setting up a custom field with name related_posts and a false value but RP is still showing.

  4. @willard97 - you're right on track. Just pick some custom field name, set it to false, say, then display the related posts using code like:

    if (get_post_custom()['show_related_posts'] !== false)
    related_posts();

    More info on custom fields are here: http://codex.wordpress.org/Custom_Fields

Topic Closed

This topic has been closed to new replies.

About this Topic