Support » Plugin: Jellyfish Counter Widget » Is it possible to generate random number?

  • Resolved ammar7



    I would like to show counter on my start up popup plugin.

    Atm its working fine..

    What i want now is that i want to show random number between 15000-15200

    I tried some thing like this..

    <?php $abc=wp_rand($min = 15000, $max = 152000);?>
       <?php echo do_shortcode('[jellyfish_counter start=$abc speed=5 end=$abc  tenths="false"] ') ?>

    But its not giving me desired out put.

    Is there a way i can do it or thats not possible?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Any help??

    Plugin Author Strawberry Jellyfish


    That’s a method i hadn’t considered, you’re very close. If you swap the single quotes for double quotes and vice versa the you’ll get the $abc variable in the shortcode actually substituted by it’s value rather than appearing as a string “$abc”

    This works:

    <?php $abc=wp_rand($min = 15000, $max = 152000);?>
       <?php echo do_shortcode("[jellyfish_counter start=$abc end=$abc tenths='false'] ") ?>

    Assuming you just want a static random value then the speed parameter is also not necessary.

    Working perfectly fine thanks..

    Endres from


    Hi Rob,

    Would it acually be possible to use this workaround for responsive sizes on mobile for counter size?!

    If yes, how would i go about it?

    Plugin Author Strawberry Jellyfish


    Hi Endres

    I’m not sure this will help you all that much. Yes you could use the same approach to give any attributes values from php including things like digit-height etc. But responsive sizes should probably be dealt with within the counter JavaScript. This would need some major changes in how the counters are built because everything relies on specific pixel values at present. Sorry i don’t have any suggestions on how to approach this.

    I’m working on a complete rewrite of the counter JavaScript for a future version of this plugin which will improve many things including responsiveness, use CSS3 animation etc. So don’t want to spend too much time on the current version which is a bit old school. But this won’t appear soon, my real work is keeping me very busy at the moment!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Is it possible to generate random number?’ is closed to new replies.