WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Contestant Rating] Useful extension (2 posts)

  1. Ad Lagendijk
    Member
    Posted 4 years ago #

    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 <?php CR_show_voting_stars(); ?> should be replaced by <?php if (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.

    http://wordpress.org/extend/plugins/contestant-rating/

  2. dingobytes
    Member
    Posted 4 years ago #

    I don't know why I never saw your reply, but I really appreciate the great feed back. I will take the style issues in to consideration as it should be easy to make those easier to style.

    This was my first wordpress plugin and it was really just an attempt to fix one that was not working with IE browser.

    I will use your comments and experience to improve the plugin.

Topic Closed

This topic has been closed to new replies.

About this Topic