• Resolved Jon Hardison

    (@jonhardison)


    Hi there!

    This works great but I can think of MANY situations where having the end integer inside the shortcode is problematic. One such example would be when using a custom field value from a page or post. While it can be done it’s more of a pain in the neck than it needs to be.

    It might be better/easier if the shortcode optionally worked something like this:
    [countup start=”0″ decimals=”0″ duration=”5″]500[/countup]

    So users could continue to use it as they do now, but gain the ability to have the end value sourced dynamically from any number of content sources.

    Does that make sense?
    Everything else about this is perfect as it is. ??

    • This topic was modified 8 years, 1 month ago by Jon Hardison.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Roel Magdaleno

    (@rokumetal)

    Hey Jon! Thanks for the feedback, I think your suggestion makes sense when the user try to get the end value dynamically. So, I’m gonna take the idea and implement it, wait for it. ??

    Plugin Author Roel Magdaleno

    (@rokumetal)

    Hi Jon! I already implemented this, now we could use the plugin in both ways:

    [countup start="0" end="55"]

    or

    [countup start="0"]55[/countup], for this, like you said, we should activate the option inside of the settings page.

    Test it and let me know if there’s any bug. Thanks! ??

    Thread Starter Jon Hardison

    (@jonhardison)

    Hey there. Sorry it’s taken me for ever to get back to this. The implementation is exactly what I’m looking for. Unfortunately, it’s not working in my situation:

    An example:
    I’m pulling in data from a third party database which is being put into a page via php. The number is a result of processed statistical data. At the end of all this, it would look something like:
    [countup duration="1"]<?php the_field('the_field_value'); ?>[/countup]

    On another note: Some of your shortcode values may also be replaced.
    An example of this might be a user specifying the type of value being sourced. If the source is a percentage, they would say so someplace else in, but their selection would be passed to your shortcode:
    [countup duration="1" suffix=”<?php the_field('the_field_type'); ?>”]<?php the_field('the_field_value'); ?>[/countup]

    Does that make sense?
    Thank you SO much for taking the time to entertain this idea.
    I apologies for the delay in getting back to you. I just got really, really busy. ??

    Plugin Author Roel Magdaleno

    (@rokumetal)

    Oh, so you’re working directly with PHP code, so you should execute this code instead of yours:

    echo do_action( '[countup duration="1"]' . the_field('the_field_value') . '[/countup]' );

    This is mostly for backend side, you could try it, but I’d recommend you to create your own shortcode to get your desired value and put it into my shortcode, something like this:

    [countup duration="] [get-my-field-value] [/countup]

    So this is all for frontend side, [get-my-field-value] should return your desired value and will apply the countup animation, and you can use in every page/post on your site.

    Hope that helps!

    Thanks,
    Roel.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Can I make a suggestion? End int outside the shortcode.’ is closed to new replies.