Today i am going to share how to add post views counting system on wordpress without any plugin. First, copy this code of php function to yours THEME functions.php file. Basically /wp-content/themes/YOUR-THEME/functions.php <? 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”; } return $count; } […]
Wordpress
Add “xx Times ago” Function without plugin on Your WordPress Theme
Today i am going to publish a php function for wp theme to show “xx hours ago”, “xx seconds ago”, “xx minitues ago”, “xx days ago” etc on wordpress post, comment etc. First copy this code of php function to yours THEME functions.php file. Basically /wp-content/themes/YOUR-THEME/functions.php <? function time_ago( $type = ‘post’ ) { $d […]