Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter anti321

    (@anti321)

    found it.. <a3> was before default template permalink code.. somehow i missed it

    Thread Starter anti321

    (@anti321)

    Thanks..

    Got my post meta key made by this link

    Current custom field is ” views_total ” from WordPress popular Post

    My theme user function.php currently is is:

    function custom_pvc_import_meta_key( $meta_key ) {
    // Use your meta-key here
    $meta_key = ‘views_total’;
    return $meta_key;
    }

    add_filter( ‘pvc_import_meta_key’, ‘custom_pvc_import_meta_key’ );

    /* Storing views of different time periods as meta keys */
    add_action( ‘wpp_post_update_views’, ‘custom_wpp_update_postviews’ );

    function custom_wpp_update_postviews($postid) {
    // Accuracy:
    // 10 = 1 in 10 visits will update view count. (Recommended for high traffic sites.)
    // 30 = 30% of visits. (Medium traffic websites)
    // 100 = Every visit. Creates many db write operations every request.

    $accuracy = 100;

    if ( function_exists(‘wpp_get_views’) && (mt_rand(0,100) < $accuracy) ) {
    // Remove or comment out lines that you won’t be using!!
    update_post_meta( $postid, ‘views_total’, wpp_get_views( $postid ) );

    }
    }

    ……
    If anyone else has WordPress popular post and wants migrate..
    Only down side is like i understood is.. have to manually view post to generate
    custom fields..

    Thread Starter anti321

    (@anti321)

    Tnx..

    If meta key was ” total_ views ” how would your plugin
    Import function look like ?

    Example i know :
    function custom_pvc_import_meta_key( $meta_key ) {
    // Use your meta-key here
    $meta_key = ‘post_views_count’;
    return $meta_key;
    }
    add_filter( ‘pvc_import_meta_key’, ‘custom_pvc_import_meta_key’ );

    But where to put “total_views” ?.. how this code look like with (total_views) meta key..?

    Thnx..

    I use php code in single.php to display results..
    How to disable some posts with php ?

Viewing 4 replies - 1 through 4 (of 4 total)