Skip to content
Public Ticket #14334

view count shortcode

Conversation thread

elguja replied

Customer Reply

Ok, thanks

PenciDesign replied

Staff Reply

Hi,

Have you used a post template from Elementor? If right, it can't work because the template from Elementor has been modified by Elementor itself and can't be affected by views counter from the theme...

Best Regards,

PenciDesign

PenciDesign replied

Staff Reply

Hi,

By default, this theme doesn't support for shortcode like that.

But, you can add more this code:

add_shortcode( 'penci_postviews', 'penci_post_views_shortcode' );
function penci_post_views_shortcode( $atts, $content = "" ) {
    if( is_single() && function_exists( 'penci_get_post_views' ) && function_exists( 'penci_get_setting' ) ){
        echo '<span class="penci-post-views-wrap"><i class="penci-post-countview-number">'. penci_get_post_views( get_the_ID() ) .'</i>'. penci_get_setting( 'penci_trans_text_views' ). '</span>';
    }
}

like on this image to create view count shortcode.

After that, you can use shortcode:  

[penci_postviews]

to showing the view count of the post. This shortcode just works on single post pages only.

Best Regards,

PenciDesign

elguja started the conversation

Conversation Start

Hello, I am creating single post with Elementor and I want to insert view counter. I want to know if the theme of the site has some short code for that.

Want to join this conversation or access attachments? Sign in first.