• Resolved Waup

    (@mm-blog)


    Hi,

    How can I stop nRelate display on certain pages.

    It’s currently showing up on Product / Store pages of Woocommerce.

    Any ideas?

    thks

Viewing 4 replies - 1 through 4 (of 4 total)
  • @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: https://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 :

    https://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 :

    https://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!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘nRelate Plugin – How to remove from certain pages?’ is closed to new replies.