• Thank you for such a useful plug-in. I have a quick question about extending a shortcode with a new feature.

    Currently the shortcode for a countdown timer looks like this:

    [wc_countdown date="Jan 1, 2018, 12:00:00 AM" format="dHMs" message="Offer Extended"]

    If I wanted to make the timer always countdown from 20 minutes every time the page is loaded, is there a way to pass “current month date year time” + 20 minutes to the shortcode?

    Or is there a way to extend your shortcode in my child theme functions.php to include support for a countdown timer with a + sign to signify adding to the current date/time then days:hours:minutes:seconds with numbers saying how long the timer will be…

    [wc_countdown date="+0:0:20:0" format="dHMs" message="Offer Extended"]

    And then generate a 20 minute countdown timer?

Viewing 1 replies (of 1 total)
  • Thread Starter moraitis

    (@moraitis)

    UPDATE

    I found a newer version of the Jquery Countdown, and with a couple of quick edits to the script, I was able to set-up a 20 minute countdown and continue to use the CSS from WPC Shortcodes that I like so much.

    To make the script match the output from WPC Shortcodes, I replaced a few span strings with div and a few “-” (dashes) strings with “_” (underscores). Then the WPC Shortcodes CSS worked with the new countdown timer generated by the script.

    My script ended up looking like this:

    <script>
            $(function () {
                $('#until20m').countdown({
                    until: '+20m',
                    format: 'DHMS'
                });
            });
        </script>

    And my HTML ended up looking like this:

    <div class="wc-shortcodes-item">
            <div class="wc-shortcodes-countdown-bg4">
                <div class="wc-shortcodes-countdown-bg3">
                    <div class="wc-shortcodes-countdown-bg2">
                        <div class="wc-shortcodes-countdown-bg1">
                            <div id="until20m" class="wc-shortcodes-countdown hasCountdown"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    It would be nice if WPC Shortcodes supported some of the other modes and features in the script. Maybe if you could pass “until” with the shortcode just like you pass “format”, then the timer features would be added.

    So the shortcode could look like this:
    [wc_countdown date="" until="+20m" format="dHMs" message="Offer Extended"]

    Thanks for considering the feature request.

Viewing 1 replies (of 1 total)
  • The topic ‘Countdown Timer Question’ is closed to new replies.