Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor dudo

    (@dudo)

    Hi, thank you for using Yasr!

    First, you’ve to find the postid of your page, then add this code to your functions.php file

    //function to remove shortcode from some page
    
    add_filter('the_content', 'yasr_website_remove_shortcode');
    
    function yasr_website_remove_shortcode ($content) {
    
        $exluded_ids = array(PUT YOUR POSTID HERE);
    
        $post_id = get_the_ID();
    
        if (in_array($post_id, $exluded_ids)) {
    
            remove_all_shortcodes();
    
        }
    
        return $content;
    
    }

    Best,
    Dario

    Thread Starter 007dutchy

    (@007dutchy)

    Thx for your reply!

    It doesn’t seem to work.. I tried putting the code in and depending on the position I out it or my site doesn’t work anymore or I get a little text before coming on the site and the rating is still there.

    Now i have: [yasr_overall_rating size=”medium”]
    instead of the stars??

    Plugin Contributor dudo

    (@dudo)

    Sorry not sure what you mean.

    You’ve to insert this code on the bottom of your functions.php file.

    If you’ve only the text shortcode [yasr_overall_rating size=”medium”] this mean that it’s working fine, and you can just remove that text.

    Thread Starter 007dutchy

    (@007dutchy)

    Yes I put it at the bottom, but before: ?>

    I can not remove [yasr_overall_rating size=”medium”] for the page as it is not in the html..?

    You can see it here:
    https://www.supremereview.com/

    Plugin Contributor dudo

    (@dudo)

    Ah, I guess that’s why you’re using the auto insert.

    Try this instead

    //function to remove shortcode from some page
    
    add_filter('the_content', 'yasr_website_remove_shortcode');
    
    function yasr_website_remove_shortcode ($content) {
    
        $exluded_ids = array(PUT YOUR POSTID HERE);
    
        $post_id = get_the_ID();
    
        if (in_array($post_id, $exluded_ids)) {
    
            $content = strip_shortcodes( $content );
    
        }
    
        return $content;
    
    }
    Thread Starter 007dutchy

    (@007dutchy)

    Yes that works! Thx!!
    When adding more pages to exclude can I just put a comma andd the other page id’s? like:
    array(23,34,56)

    Plugin Contributor dudo

    (@dudo)

    Yes ??

    Thread Starter 007dutchy

    (@007dutchy)

    Thanks!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Remove ratings on Front page’ is closed to new replies.