Support » Plugin: WP-PostRatings » how to insert the code to display on specific templates

  • Hi,

    Excellent plugin.

    I followed the directions and placed the code within the index.php file. It displays perfectly on the home page on each post, and also within a single post.

    But, the problem is that the ratings also display on pages and buddypress profiles.

    I tried going into single-posts.php and placing the code there, and it works for single posts. But then it doesn’t display on the home page.

    So basically, what I’m trying to do is to get the ratings to show on the home page and within each post, but nowhere else. That’s it.

    This is the code that shows ratings on the home page and within a post, but also displays the ratings everywhere else:

    <?php if ( have_posts() && ! is_404() ) : ?>
     <?php while ( have_posts() ) : ##all other cases for single and lists: post, custom post type, page, archives, search, 404 ?>
         <?php the_post(); ?>
                <?php do_action ('__before_article') ?>
    
                       <article <?php tc__f('__article_selectors') ?>>
                               <?php do_action( '__loop' );
    			  	<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
    </article>
                                    <?php do_action ('__after_article') ?>

    Any ideas how to fix it? My coding skills are crap. Thanks.

    https://wordpress.org/plugins/wp-postratings/

Viewing 1 replies (of 1 total)
  • Thread Starter marioluigi

    (@marioluigi)

    I tried some more. Still can’t get it to work how I want.

    Is there some CSS code I could use to stop the ratings from displaying on buddypress profiles?

    If I use:

    .post-ratings {display:none;}

    it hides it from everywhere. I just need it hidden on profile pages instead of everywhere.

Viewing 1 replies (of 1 total)
  • The topic ‘how to insert the code to display on specific templates’ is closed to new replies.