Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #898661
    clefler
    Participant

    Is there a way to pass the number of comments for a given page to one of the number counter elements?
    I was led below for where the comment code is but don’t know how to get a counter to reference the number of comments for a specific page.
    https://community.theme.co/forums/topic/display-post-view-count-with-icon-in-meta/

    #899627
    Lely
    Moderator

    Hello There,

    Thanks for posting in.

    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    Then add the following code on your child theme functions.php file:

    function custom_comment_counter(){
      
    echo do_shortcode('[counter num_start="0" num_end="'.get_comments_number().'" num_speed="1500" num_color="#272727" text_below="Counters"]');
    
    }
    add_shortcode('custom_counter_shortcode', 'custom_comment_counter');
    
    

    To display the counter with number of comments, please add the following shortcode inside a RAW content element:

    [custom_counter_shortcode]

    Hope this helps.

    #900865
    clefler
    Participant

    Great!
    Is there a way to display the comments from one page in the counter located on a separate page?

    #901865
    Rupok
    Member

    Hi there,

    Thanks for updating. It could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities. Thanks for understanding. Take care!

  • <script> jQuery(function($){ $("#no-reply-898661 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>