• Resolved Matt Cromwell

    (@webdevmattcrom)


    I really like this plugin. Just have one request/contribution. Some widgets or sidebars are Custom Post Types. If you add them to a page, then the Reaction Buttons output there as well. I see you have a global, but what is better is to be able to conditionally disable the output based on post type.

    So here’s what I’ve done.

    1) On line 181 of reaction_buttons.php I added a filter to the return like this:
    return apply_filters('reaction_buttons_output', $html);

    2) Then I use that filter to conditionally disable the Reaction Buttons output for my chosen CPT like this:

    
    add_filter('reaction_buttons_output', 'hilrev_disable_react');
    
    function hilrev_disable_react($html) {
        if ( 'endo_wrc_cpt' == get_post_type() ) {
            $html = '';
        }
    
        return $html;
    
    }
    

    So just changing that one line would make things MUCH easier for developers to use your plugin more extensively and correctly. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filter the output for more developer flexibility’ is closed to new replies.