How to remove the Unattached filter on Media Library List?

As it turns out, with the introduction of the WP_List_Table class, view filter are now hookable and specifically you can filter out that detached link like so.. add_filter( ‘views_upload’, ‘upload_views_filterable’ ); function upload_views_filterable( $views ) { unset( $views[‘detached’]); return $views; } Bye bye detached link!… 🙂

Show number of views in the last 48 hours

There’s no way to identify when each of the page view’s recorded happened. It’s only logging the page view, not when it happened. To work around this you could keep a post_meta entry for each view, but this could create a lot of entries on popular sites. Alternatively you could keep daily counts & delete … Read more

How to improve post views count display?

Yes you can. You have to check if the post view count is higher than 1000, is so, then round it and return it: function getPostViews($postID) { $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”) { delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); return “0 View”; } if ($count > 1000) { return round ( $count … Read more

How to show post views on single.php page?

Your implementation of the getPostViews function looks fine, and I don’t see an issue having that inside your single.php or breadcrumbs.php. However, I would move both functions into your functions.php (more info here) and rather than calling setPostViews inside single/breadcrumbs.php, I would attach it to a WordPress action. <?php //…inside your functions.php… add_action( ‘init’, ‘fa_setpostviews’ … Read more