• Hi there,

    I am using WP-PostRatings for years. Now I am facing a few problems in Google Search Console regarding Schema and rating issues. So I want to exclude a few posts from post ratings.

    I am using this code:

    <main id="main" class="main-box main-box-single">
    <?php if(function_exists('the_ratings')) { the_ratings(); } ?>
    <?php while ( have_posts() ) : the_post(); ?>

    In single.php file of Voice theme. Please remember that I want to exclude only 3 posts from all 600+ posts.

    Thank you

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Lester Chan

    (@gamerz)

    1. <?php if(function_exists('the_ratings')) { the_ratings(); } ?> shld be after the_post();
    2. You can do something like <?php if ( function_exists( 'the_ratings' ) && ! in_array( get_the_id(), [ 1, 2, 3 ] ) ) { the_ratings(); } ?>

      Assuming 1,2,3 is your post ID
    • This reply was modified 1 year, 4 months ago by Lester Chan.
Viewing 1 replies (of 1 total)
  • The topic ‘How to exclude a post from WP-Postratings’ is closed to new replies.