• Resolved nate_hellaclips

    (@nate_hellaclips)


    Hello!

    just dowloaded your plugin to replace another that had been blacklisted from my server. So far I am adjusted and enjoying your plugin. In the last plugin I had, I was able to use a provided tag to display the ALL TIME TOTAL VIEWS for a post, is there sis a tag for this plugin?

    I tried: get_tptn_post_count_only( $count = ‘total’ ); but Im not sure this is rite.

    thank you
    Nate

    https://wordpress.org/plugins/top-10/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ajay

    (@ajay)

    All time views for a post is just the default one.

    <?php if(function_exists('echo_tptn_post_count')) echo_tptn_post_count(); ?>

    Can you try the above code?

    Thread Starter nate_hellaclips

    (@nate_hellaclips)

    Hi Ajay,

    I should have done a bit more explaining, I just imported a bunch of posts from my old site (around 20,000 posts), Im trying to add the view count from your plugin to old the view count from my old site that I transferred over as a custom field. I wrote a function to add them together and display as one:

    function get_post_views() {
        $wpviews = The code Im asking for would go here;
        $hcviews = get_post_meta( get_the_ID(), 'post_views', true);
    
        $hcviews = ( $hcviews != '' ? $hcviews : 0 );
    
        if( $wpviews > 0 && $hcviews > 0 ) {
          return $wpviews + $hcviews;
        } elseif( $wpviews > 0 && $hcviews == 0 ) {
          return $wpviews;
        } elseif( $wpviews == 0 && $hcviews > 0 ) {
          return $hcviews;
        } else {
          return 0;
        }
    }

    As you can see I’m not looking to echo there view count from your plugin here, just trying to pull it to be added to my custom field number.

    Thanks

    Plugin Author Ajay

    (@ajay)

    Hi,

    You should be able to use:

    $wpviews = get_tptn_post_count_only( get_the_ID(), 'total' );
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘how echo total all time view count’ is closed to new replies.