WordPress.org

Ready to get started?Download WordPress

Forums

Charity-thermometer
Nice Concept, but Too Complex (3 posts)

3 stars
  1. jkereako
    Member
    Posted 8 months ago #

    I do like the plugin, but the one issue I have is that it is unnecessarily complex.

    The thermometer's behavior is controlled with JavaScript and a <canvas> tag, so why does this plugin create a custom post type? A shortcode which passes attributes, in place of a custom post-type, would suffice.

    [wpch_thermometer header="2013 Fundraiser" footer="Help us reach our goal!" goal="5000" current="250"]

    Aside from making the code more difficult to understand, the custom post-type also adversely affects performance.

  2. jkereako
    Member
    Posted 8 months ago #

    Also, the values for the thermometer's goal and current value are stored in a hidden <input> tag. This is also unnecessary. Hidden input fields are only required in form submissions, and that isn't what's happening here. The values ought to have been stored as a data attribute.

    <p id="wpch_target_value" data-target="5000">$5,000</p>
    <p id="wpch_cti_img" data-current="250">$250</p>

    or better, as properties of a JavaScript object printed directly into the source. Using this approach reduces complexity because you won't have to extract the value from a data attribute using jQuery.

    <script type="text/javascript">
        wpchVals = {"target": 5000, "current": 250};
    </script>

    Apologies for being so critical.

  3. crea8xion
    Member
    Plugin Author

    Posted 8 months ago #

    Hi,

    nice point out.. this is the very first submission I have and really don't have time to revised the code.

    Anyway thanks for pointing out. I'm planning to upgrade this plugin or replaced this one, looking for a free time.

    Thanks.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.