@mm-blog — Thanks for using nRelate on your site. You can remove the plugin from showing on certain posts or pages by following the instructions here: http://nrelate.com/theblog/2011/10/19/remove-nrelate-from-a-particular-post-or-page/
Thread Starter
Waup
(@mm-blog)
Cheers Katrina. For others:
/** Hide nRelate Related Posts on WooCommerce Estore */
function hide_nrelate_from_posts($load_nrelate) {
if ( is_product(“post-id-here”) ) {
$load_nrelate = false;
}
return $load_nrelate;
}
add_filter(‘nrelate_related_is_loading’, ‘hide_nrelate_from_posts’);
And conditional tag info here :
http://docs.woothemes.com/document/conditional-tags/
Cheers Katrina. For others:
/** Hide nRelate Related Posts on WooCommerce Estore */
function hide_nrelate_from_posts($load_nrelate) {
if ( is_product(“post-id-here”) ) {
$load_nrelate = false;
}
return $load_nrelate;
}
add_filter(‘nrelate_related_is_loading’, ‘hide_nrelate_from_posts’);
And conditional tag info here :
http://docs.woothemes.com/document/conditional-tags/
Hi WPBlogger, I guess this code stop the nrelate being loaded and displayed and if it does would you be able to explain where this needs to go in the woocommerce theme/pages?
I did read the link but its a bit beyond my knowledge at the moment.
Thanks 🙂
This got me on the right track, however I did not want to have to update my functions.php with a new “post ID” every time a new product was added.
Between the two links provided I came up with this which eliminates nRelate on all product pages no matter when you add them.
function hide_nrelate_from_cat($load_nrelate) {
if ( is_product() ) {
$load_nrelate = false;
}
return $load_nrelate;
}
add_filter('nrelate_related_is_loading', 'hide_nrelate_from_cat');
The “is_product” is the WooCommerce hook for product pages so I used that instead of the “is_product..post-id-here” method.
Hope it helps!