WordPress.org

Forums

WP-PostRatings
Hide rating score if no ratings, for guest users only (2 posts)

  1. Roni Marinkovic
    Member
    Posted 3 years ago #

    Is there a way not to display empty rating (no votes) on posts for non logged in users? (without modifying plugin code!)
    Show ratings only if there are votes, if no votes then show only to logged in users.

    http://wordpress.org/extend/plugins/wp-postratings/

  2. Roni Marinkovic
    Member
    Posted 3 years ago #

    Finally... here it is if someone else needs it...
    This will show ratings for guest users only if there is a rating for that post. Use in single.php or your custom single template.

    $postid = get_the_ID();
    $rating = get_post_meta($postid, 'ratings_score', 'true');
    if ( !is_user_logged_in() && empty($rating)) {
    	echo '';
    } else {
    	echo '<div id="rating">'.the_ratings().'</div>';
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.