Support » Plugin: WTI Like Post » [Plugin: WTI Like Post] how to show like/dislike in one number?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,
    I was wondering if you could point me out where do you print out the like and dislike numbers. I can quickly do a subtraction of both and print a new number out. This would resolve my question.

    thanks

    this is what I have. However, the unlike still showing “+” in front the unlike value. Thanks

    global $wpdb;
         $show_symbols = get_option('wti_like_post_show_symbols');
         $wti_unlike_count = $wpdb->get_var("SELECT SUM(value) FROM {$wpdb->prefix}wti_like_post WHERE post_id = '$post_id' AND value <= 0");
         $wti_like_count = $wpdb->get_var("SELECT SUM(value) FROM {$wpdb->prefix}wti_like_post WHERE post_id = '$post_id' AND value >= 0");
         if(!$wti_like_count) {
    		$wti_like_count = 0;
         }
    
    	 if(!$wti_unlike_count) {
    		$wti_unlike_count = 0;
         } else {
    		if($show_symbols) {$wti_unlike_count;
    		} else {
    			$wti_unlike_count;
    		}
         }
    
    	 if($wti_like_count != $wti_unlike_count){
    
       if($wti_like_count > $wti_unlike_count){$wti_like_final = $wti_like_count - $wti_unlike_count;$wti_like_final = "+" . $wti_like_final;}
       else{$wti_like_final = $wti_unlike_count - $wti_like_count;$wti_like_final = "-" . $wti_like_final;}
       }
       else
    
       {$wti_like_final = '0'; }
    
    	  return $wti_like_final;
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WTI Like Post] how to show like/dislike in one number?’ is closed to new replies.