• Resolved Gustavo Viegas

    (@gustavorviegas)


    Exists Any solution for this problem ?

    https://www.ads-software.com/support/topic/counters-not-working-with-w3-total-cache

    Good day,

    I’m developing a new site and have used your plugin. I’m currently displaying total post views by using the following in my content.php file

    <span id=”tptn_post_count_only”><?php echo get_tptn_post_count_only($id, $count = ‘total’); ?></span>

    After enabling W3 Total Cache the count is no longer incremented correctly. If I enable the W3 Total Cache Fix toggle in your plugin settings the total increments by multiples of 2 for logged in users and not at all for users that aren’t logged in.

    Do you have any troubleshooting suggestions? Unfortunately the site is currently running locally on a development system so I am unable to provide you access to it.

    Thanks for your help.

    https://www.ads-software.com/plugins/top-10/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WebberZone

    (@webberzone)

    Hi,

    The solution posted above still stands. You need to use a custom piece of code similar to echo_tptn_post_count

    https://github.com/WebberZone/top-10/blob/master/top-10.php#L352

    This snippet specifically makes the count dynamic:

    $output = '<div class="tptn_counter" id="tptn_counter_' . $id . '"><script type="text/javascript" data-cfasync="false" src="' . $home_url . '?top_ten_id='.$id.'&view_counter=1&_wpnonce=' . $nonce . '"></script></div>';
    Thread Starter Gustavo Viegas

    (@gustavorviegas)

    I realized contradictory in parts … Can you give a practical example of how to put on single.php file for example?

    Thread Starter Gustavo Viegas

    (@gustavorviegas)

    Sorry … actually is working..! i wanted to put in an explicit location in the subject ( would not start the formatting <div class=”tptn_counter” ) … added direct on the theme:

    <?php
    $id = intval( $post->ID );
    $nonce_action = ‘tptn-nonce-‘ . $id ;
    $nonce = wp_create_nonce( $nonce_action ); ?>
    <span class=”views”><i class=”fa fa-eye”></i> <script type=”text/javascript” data-cfasync=”false” src=”<?php echo home_url(‘/’);?>?top_ten_id=<?php echo $id;?>&view_counter=1&_wpnonce=<?php echo $nonce;?>”></script>
    </span>

    Working perfectly! Thanks for the great plugin!

    Plugin Author WebberZone

    (@webberzone)

    You’re welcome.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘W3 Total Cache: Count is no longer incremented!!’ is closed to new replies.