Home Forums WTI Like Post PRO Override output of GetWtiLikePost Reply To: Override output of GetWtiLikePost

#157
firefly
Participant

Gotcha ok.

On the off chance this helps someone else, here are some utility methods for dealing with buttons/counts (based on ripping apart GetWtiLikePost). Just stick them in functions.php

http://pastebin.com/JzFeKkUb

They all take an optional post_id as an argument so can be used outside the loop. Additionally they check for the existence of plugin methods (using ff_is_like_enabled), so disabling the ‘like’ plugin doesn’t break the theme.

The method names follow general wordpress convention:
ff_XX = echo XX
ff_get_XX = return XX as string

Wherever you place the tally number has to have the class ‘lc lc-{{post_id}}’ – e.g.
$id = $post->ID;
$num_likes = ff_get_like_count($id);
printf(‘<span class=”tally-value lc lc-%d”>%d</span>’, $id, $num_likes);

That way you don’t need to mess with the default plugin javascript and all the ajax stuff works.