WordPress.org

Ready to get started?Download WordPress

Forums

Yet Another Related Posts Plugin (YARPP)
[resolved] [Plugin: Yet Another Related Posts Plugin] Disable "Automatically display related posts?" (4 posts)

  1. john_wdl
    Member
    Posted 2 years ago #

    Hello,

    I am a theme creator and i want to add YARPP support to my themes. I will be using manual method and i want to save the users the trouble of going to YARPP settings page and unchecking it (Mostly because some may find it hard)

    So how can i uncheck "Automatically display related posts?" by default? and CHECK "Display using a custom template file" by default?

    Are there any lines in the plugin i can edit?

    Thanks,
    John

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

  2. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    @john_wdl interesting idea. And before I say anything else, thank you for adding YARPP support to your theme! :)

    Here's the code you want, where yarpp-template-bundled.php is the YARPP template in the root directory of your theme:

    yarpp_set_option('auto_display', false);
    yarpp_set_option('use_template', true);
    yarpp_set_option('template_file', 'yarpp-template-bundled.php');

    and, if appropriate:

    yarpp_set_option('rss_use_template', true);
    yarpp_set_option('rss_template_file', 'yarpp-template-bundled.php');

    There's a question about when this should happen, though. If YARPP is installed first and then your theme is activated, it may seem surprising that their YARPP settings were changed (if you don't tell them), particularly as switching back to another theme won't revert these options (unless you build that, but that seems like much).

    Also, to check that YARPP is installed, you should check defined('YARPP_VERSION') and probably version_compare(YARPP_VERSION, $supported_yarpp_version) !== -1 so you just don't support older YARPP versions.

    Hope that helps!

  3. john_wdl
    Member
    Posted 2 years ago #

    Hello mitcho,

    No, let me thank you for creating this plugin :)

    Thanks for the quick reply, where do i put this code?

    Thanks,
    John

  4. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    Well, putting it in your functions.php is the simplest, but there's no need to rerun this over and over... you'll probably want to write some code to figure out when your theme is activated... unfortunately there's no built in hook for that now so you'll have to hack something together. :(

    http://core.trac.wordpress.org/ticket/7795

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic