Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #2558228
view count shortcode
Closed

Comments

  • elguja started the conversation

    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.

  •  2,699
    PenciDesign replied

    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

  •  2,699
    PenciDesign replied

    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

  • elguja replied

    Ok, thanks