i trying extract total number of likes associated different posts wti post pro wordpress plugin, subtract number of unlikes , feed total meter gauge (gaugepress in wordpress...which suspiciously similar found in http://justgage.com/).
the meter this:
https://wordpress.org/plugins/gaugepress/screenshots/ (see link don't have reputation post images)
in addition, need 1 'like' (vote) represent several 'units' on meter, e.g. 1 = 8 units.
i've tried asking authors of both plugins, have had no response.
here code wti post pro:
function getwtilikecount($post_id) { global $wpdb; $show_symbols = get_option('wti_like_post_show_symbols'); $wti_like_count = $wpdb->get_var("select sum(value) {$wpdb->prefix}wti_like_post post_id = '$post_id' , value >= 0"); if (!$wti_like_count) { $wti_like_count = 0; } else { if ($show_symbols) { $wti_like_count = "+" . $wti_like_count; } else { $wti_like_count = $wti_like_count; } } return $wti_like_count; } /** * unlike count post * @param $post_id integer * @return string */ function getwtiunlikecount($post_id) { global $wpdb; $show_symbols = get_option('wti_like_post_show_symbols'); $wti_unlike_count = $wpdb->get_var("select sum(value) {$wpdb->prefix}wti_like_post post_id = '$post_id' , value <= 0"); if (!$wti_unlike_count) { $wti_unlike_count = 0; } else { if ($show_symbols) { } else { $wti_unlike_count = str_replace('-', '', $wti_unlike_count); } } return $wti_unlike_count; }
so firstly, need each 'like' represent 8 units on meter, , need total figure enter gauge represents number of likes, subtracted number of unlikes. like:
$new_total_figure = ($wti_like_count * 8) - ($wti_unlike_count * 8)
and know if "$new_total_figure" can entered shortcode gaugepress?
something like:
[gauge width="400px" height="220px" value="$new_total_figure" min="0" max="150" title="first gauge" label="km" showminmax="true" color="#e16300" backcolor="#ededed" widthscale="0.8"]
if knows how gauge, rather gaugepress, good.
thanks!
Comments
Post a Comment