Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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, '0');
- }
- else {
- $count++;
- update_post_meta($postID, $count_key, $count);
- }
- add_action('end_session_action','end_session');
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement