Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34420
    Olena
    Participant

    Hi everyone!

    I use Zeen Theme and want to show visits count number. So, I edited function.php file as I was told by Zeen Theme support:

    function my_custom_visits( $pid = ” ) {
    return pvc_post_views( $pid, false );
    }
    add_filter( ‘zeen_view_count_custom’, ‘my_custom_visits’ );
    add_filter( ‘zeen_view_count_use_jetpack_stats’, ‘__return_false’ );

    But it doesn’t work. Zeen Support told me that the problem is within pvc_post_views function (it always returns 0 number).

    THANKS A LOT IN ADVANCE!

    #43762
    memt
    Participant

    Hi,

    I’m having the same issue. Not for this plugin. But i’m trying to bring back the post counter from valenti.

    In their support, they told me to add the following to the childs functions.php
    As I was still in build, now it seems not to work..

    function my_custom_visits( $pid = '' ) {
    $output = get_post_meta( $pid, 'cb_visit_counter', true );
    return $output;
    }
    add_filter( 'zeen_view_count_custom', 'my_custom_visits' );
    add_filter( 'zeen_view_count_use_jetpack_stats', '__return_false' );

    But the visit counter from Valenti will obviously not continue being updated, so if you want them to carry on, you also need to add this function:

    function my_custom_visits_ticker() {
    if ( ! is_single() ) {
    return; 
    }
    global $post;
    $pid = $post->ID;
    $visits = get_post_meta( $pid, 'cb_visit_counter', true );
            if  ( strlen( $visits ) == 0 ) {
                delete_post_meta( $pid, 'cb_visit_counter' );
                add_post_meta( $pid, 'cb_visit_counter', 1 );
            } else {
                update_post_meta( $pid, 'cb_visit_counter', $visits + 1 );
            }
    }
    add_action( 'wp_head', 'my_custom_visits_ticker' );

    Did you get yours to work already?

    #50667
    frdalizade
    Participant

    // Change Views Count Source
    function my_custom_visits( $pid = “” ) {
    return pvc_post_views( $pid, true );
    }
    add_filter( ‘zeen_view_count_custom’, ‘my_custom_visits’ );
    add_filter( ‘zeen_view_count_use_jetpack_stats’, ‘__return_false’ );

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.