• Resolved nilssondigital

    (@nilssondigital)


    I’m using the Geodirectory conditional css class to hide the review stars if there are no reveiws (rating count < 1) and it works great.

    I’d like to apply this to the map bubble, so I can show/hide the review stars there as well.

    I’ve tried something like the folowing, but assume it’s not working maybe because it’s not hooked into the query loop?

    <?php function display_div_based_on_comment_count() {
      $commentCount = get_comment_count(); // Get the comment count for the current post/page
    
      if ($commentCount['total_comments'] > 0) {
        echo '<div class="geodir-bubble-meta-top clearfix">
             [gd_post_rating show="stars" alignment="left"]
    	</div>';
      }
    }
    ?>

    Is there a way I can do this?

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

Viewing 1 replies (of 1 total)
  • Plugin Author Stiofan

    (@stiofansisland)

    Give this a try and let me know:

    function display_div_based_on_comment_count() {
    	global $gd_post, $post;
    
    	$post_id = ! empty( $gd_post ) ? (int) $gd_post->ID : ( ! empty( $post ) ? (int) $post->ID : 0 );
    
    	$post_rating = (float) geodir_get_post_rating( $post_id ); // Get the comment count for the current post/page
    
    	if ( $post_rating > 0 ) {
    		echo '<div class="geodir-bubble-meta-top clearfix">[gd_post_rating show="stars" alignment="left"]</div>';
    	}
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Use conditional css class in map popup bubble’ is closed to new replies.