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
  • 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

    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.

    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)