[Plugin: Contestant Rating] Useful extension
-
I like the plugin very much. It is very simple.
The absence of an options page has advantages and its drawbacks as no tailoring is possible at all. This has to be done by hard coding and will be lost on upgrading the plugin to a new version. I did change the plugin file to show a different text, and to show “vote” or “votes” dependent on the number of votes.REMARK
I think the suggested usage <?phpCR_show_voting_stars();
?> should be replaced by <?phpif (function_exists('CR_show_voting_stars')) CR_show_voting_stars();
?>
In this way the plugin can be safely removed without leaving behind a crashing blog. Cleaning up of the templates could then be done later. However, I like the next solution even better.EXTENSION
At present the plugin works by calling its functions somewhere in a template. As a result all posts using that template will show the rating. However, in my case I would only like to have the rating only at a few posts. The way to accomplish this is to introduce a shortcode. An additional advantage is that uninstalling the plugin would not lead to a crash.
So in the file contestant-rating.php I introduced the following code:function CR_show_voting_stars_handler () { ob_start(); global $CR; echo $CR->getVotingStars(); $out = ob_get_contents(); ob_end_clean(); return $out; } add_shortcode('CR_show_voting_stars_handler', 'CR_show_voting_stars_handler');
It seems to work pretty good. Anywhere in the post I can introduce [CR_show_voting_stars_handler] to show the rating. I have not yet come across unwanted side effects. I use it only on a few posts. Two examples: Example 1 and Example 2. As this was introduced only very recently there are almost no votes yet.
- The topic ‘[Plugin: Contestant Rating] Useful extension’ is closed to new replies.