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.
Thread Starter
ammar7
(@ammar7)
Working perfectly fine thanks..
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?
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!