Shortcode in Counter displays 0

Home Forums Jevelin Theme Shortcode in Counter displays 0

Home Forums Jevelin Theme Shortcode in Counter displays 0

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • DebtCase
    Participant

    Newbie post.

     

    I’ve created a shortcode [user_count] which returns the number of subscribers. It works fine in a Text Block, but if I try to put it into a Counter it just returns 0. Am I missing some extra code?

     

    Thanks

    Hi @DebtCase,

     

    I hope you are well today and thank you for your question.

     

    It depends on how you have created that shortcode and where you are adding it to display in counter so could you please tell us more information about it so that we can help you?

     

    Best regards,
    Shufflehound team

    DebtCase
    Participant

    Thanks for the response.

     

    I create the shortcode in functions.php:

     

    function wpb_user_count() {
    $usercount = count_users();
    $subscribers = $usercount[‘avail_roles’][‘subscriber’];
    return $subscribers;
    }
    add_shortcode(‘user_count’, ‘wpb_user_count’);

     

    Then add [user_count] into a Text Block and displays the correct number of subscribers.

     

    If I add the same [user_count] into a Counter element (whether in a column, section or directly onto the page) it just returns 0.

    In which of the counter element fields are you adding it as shown in the attached screenshot?

    Attachments:
    You must be logged in to view attached files.

    DebtCase
    Participant

    The number field.

    Thanks

    You can try achieving this by using the attached custom child theme of Jevelin theme that contains some custom code.

    Attachments:
    You must be logged in to view attached files.
Viewing 6 posts - 1 through 6 (of 6 total)

Popular choice

Professional Developers At Your Fingertips!

If you need services beyond standard support, we've got your back!

Services we offer:

Demo setup
Advanced customization
Layout adjustment
Graphic work / visualizations
Custom coding
Full WordPress development and design

Services

What we can offer

  • Demo setup +

    If you'd prefer not to handle the installation yourself or need help getting started, we'll set everything up for you.

  • Layout adjustment +

    We'll help you rearrange sections, adjust spacing, and modify the page structure to fit your needs.

  • Advanced customization +

    More complex styling changes, theme option modifications, and third-party integrations.

  • Custom coding +

    If you need something that's not included in the theme, we can code it for you.

  • Graphic work / visualizations +

    Web design services to create custom sections, pages, and blocks for your theme, plus graphics and visualizations.

  • Full WordPress development and design +

    Full website builds, custom theme development, or plugin creation from scratch.

  • About pricing +

    We'll provide a clear quote based on what you need. No hidden fees.

Professional Developers At Your Fingertips!

Custom Work Form