All posts by admin

How to track & show WordPress post views without a plugin – WP-Snippet.com How to track & show WordPress post views without a plugin – WP-Snippet.com

// function to display number of posts. 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”;     }     return $count.’ Views’; } // function to count views. function setPostViews($postID) {     $count_key = ‘post_views_count’;     $count = get_post_meta($postID, $count_key, true);     if($count==”){         $count = 0;         delete_post_meta($postID, $count_key);         add_post_meta($postID, $count_key, … Continue reading How to track & show WordPress post views without a plugin – WP-Snippet.com How to track & show WordPress post views without a plugin – WP-Snippet.com

WordPress Code Snippets & Development Tips – WP-Snippet.com WordPress Code Snippets & Development Tips – WP-Snippet.com

Learn how to restrict WordPress media library access to user’s own uploads. By default, WordPress allows authors/users to see all images uploaded to a WordPress site’s media library. This could be a problem if your site has users with individual images/galleries. This WordPress snippet will allow you to restrict WordPress media library access to user’s … Continue reading WordPress Code Snippets & Development Tips – WP-Snippet.com WordPress Code Snippets & Development Tips – WP-Snippet.com