Advertisement
Guest User

Untitled

a guest
May 31st, 2017
359
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function setPostViews($postID) {
  2. $countKey = 'post_views_count';
  3. $count = get_post_meta($postID, $countKey, true);
  4. if($count==''){
  5. $count = 0;
  6. delete_post_meta($postID, $countKey);
  7. add_post_meta($postID, $countKey, '0');
  8. }else{
  9. $count++;
  10. update_post_meta($postID, $countKey, $count);
  11. }
  12. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement