WordPress.org

Ready to get started?Download WordPress

Forums

WP Most Popular
View Count (4 posts)

  1. rewberl
    Member
    Posted 2 years ago #

    The best 'popular post' plugin I've found. If you could, I would appreciate the option to display the post count next to the post titles in the widget (perhaps in parentheses?). Thank you!

    http://wordpress.org/extend/plugins/wp-most-popular/

  2. thatwastaxing
    Member
    Posted 2 years ago #

    +1 (unless it's resource intensive)

  3. MattGeri
    Member
    Plugin Author

    Posted 2 years ago #

    Hi there!

    Thanks for the feedback.

    I will definitely add this to the feature list for an upcoming release.

    Matt

  4. 0x539
    Member
    Posted 1 year ago #

    6 Months ago, probably not needed anymore but here goes anyway:

    function get_post_views($postID, $period = 'all_time'){
        global $wpdb;
    
        $sql = "
            SELECT
                *
            FROM
                {$wpdb->prefix}most_popular mp
            WHERE
                post_id = {$postID}
        ";
    
        $result = $wpdb->get_row($sql, 'ARRAY_A');
    
        if (is_array($result))
        {
            switch ($period)
            {
                case 'all_time':
                    return $result['all_time_stats'];
                    break;
                case '1_day':
                    return $result['1_day_stats'];
                    break;
                case '7_day':
                    return $result['7_day_stats'];
                    break;
                case '30_day':
                    return $result['30_day_stats'];
                    break;
                default:
                    return $result['all_time_stats'];
                    break;
            }
        }
        else {
            return 0;
        }
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic