It seems that the solution provided by msubretort which uses css to hide the YARRP is the quickest way forward at this point. This technique could also be applied to QuickAdsense and any other post plugin.
Use custom css (see doc for placement location) and then provide the specific tag to hide, starting with the tpg division. Use a browser debugger to find the exact sequence of tags to hide so only those YARRP classes in the tpg-get-post div are hidden.
By putting the css in the custom css file in your template, the changes will not be lost with upgrades to the plugin. And if you are using a child template, upgrades to the template will not affect the custom css which is in the child theme folder.
What the plugin should do is accurately display the post on a static page. Then allow you to customize display options.
The other option is with the premium version you can call a custom function and turn off/on the hooks for the post. While the plugin supports that capability, it is up to the developer to write the code. I am unable to support custome php solutions, but here is what my testing code looked like (with echo’s for testing included)
function tpg_gp_pst_post_filter($content,$cfp=null) {
/*
* the following code is a sample to add the MPR & Yet Another Related post plugins
* uncomment to activate sample
*/
echo "in pst_post filter<br>";
add_filter('the_content','MRP_auto_related_posts');
global $yarpp;
add_filter('the_content', array($yarpp,'the_content'), 1200);
return $content;
}
/**
* tpg_gp_pre_plugin_filter
*
* allow custom function to be invoke before content
*
* @param string content
* @param string custom function parm
* @return string content
*
*/
function tpg_gp_pre_plugin_filter($content,$cfp=null) {
/*
* the following code is a sampe to turn off MPR & Yet Another Related post plugins
* uncomment to activate sample
*/
echo "in pre_plugin filter<br>";
remove_filter('the_content','MRP_auto_related_posts');
global $yarpp;
remove_filter('the_content', array($yarpp,'the_content'), 1200);
return $content;
}
I will try the CSS change for now. I assume on an update of the plugin that will get lost?
From my comment above:
By putting the css in the custom css file in your template,
the changes will not be lost with upgrades to the plugin.
And if you are using a child template, upgrades to the
template will not affect the custom css which is in
the child theme folder.
If you follow the guidelines in the doc for custom styling, the only time you need to be concerned with loosing the css changes is when you upgrade the theme. Or if you use a child theme, only when you upgrade the child theme. An additional reason for using child themes.
If you change the plugin css directly, then the changes will be lost, so don’t do that. Set up a custom css file.
According to the post above it could not be done in the theme CSS as it removed it from all pages:
“I tried putting it in the .css file, but the css file gets called on every page, so it was hiding the yarpp addons on posts where tpg wasn’t called.
Maybe the author of the plugin can figure out a more elegant solution.”
So I used this change from above which worked but it’s not really CSS based:
Edit /tpg-get-posts/inc/class-tpg-gp-process.php Line 302
Change
$content = ‘<div id=”tpg-get-posts” >’;
to
$content = ‘ <STYLE type=”text/css”>.yarpp-related {display:none}</STYLE><div id=”tpg-get-posts” >’;
It depends on how specific you write the css. if you write the css for the class within the tpg-get-posts div only, then it only suppresses the display for the posts being rendered by the plugin.
You will have to do some work to determine the specificity of the needed css.