Support » Plugin: Jellyfish Counter Widget » How to use shortcode in php files

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Strawberry Jellyfish


    You should at least get a blank counter 000000 showing with
    <?php echo do_shortcode('[jellyfish_counter]') ?>

    Obviously, you’ll need to add parameters to get it to do what you want, eg:
    <?php echo do_shortcode('[jellyfish_counter end=100 ....other params... ') ?>

    If it isn’t showing, check the html source of the page. If there is a div in the source where the counter should be looking something like this <div id=”jellyfish-counter-shortcode-14……. then the shorcode is working but something is up with the JavaScript that actually turns the div into the counter. If you don’t get that div at all then something must be wrong with how you are calling the shortcode.

    Hey thanks for the reply when i view the html source i do see this <div id="jellyfish-counter-shortcode-14....... So how to fix those JS errors??

    Plugin Author Strawberry Jellyfish


    Hard to say exactly how to fix without what’s knowing what is going on.

    Just to rule it out, check that the counter javascript is actually being enqueued properly and referenced in the page source – you should find links to these js files somewhere in your page source:


    Then I’d suggest establishing if you get any errors showing when viewing the page in your web browser of choice with the developer tools / javascript console open, that might give some clues.

    Some how i resolved it in ugly manner.

    I realised that counter was showing when i embed it in header.php. but two counter were comming one in header and other on my desired position.

    so what i did i just wrapped shortcode in div in header.php and styled like : display:none; it got hided and the desired shortcode was there and running 😉

    Thanks for the help

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to use shortcode in php files’ is closed to new replies.