Filter the output for more developer flexibility
-
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 thereturn
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!
- The topic ‘Filter the output for more developer flexibility’ is closed to new replies.