All Good Things Must Come To An End

As you all know, I have been doing WordPress plugins and supporting it for the past 6 years. These 6 years of my life, I have been through my polytechnic education, my national service as well as my university education.

I just graduated from university in December 2009 and have been looking for full-time jobs. I am offered a full-time job and will be starting work on 1st February 2010.

I regret to say that I am NOT ABLE to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

However, I WILL still update my plugins whenever I can and you still can report bugs to me via email and I will try to fix it.


Author Topic: Modifying add_post_meta and $post_views  (Read 539 times)

0 Members and 1 Guest are viewing this topic.

Offline Andrew Wilson

  • Newbie
  • *
  • Posts: 1
    • View Profile
  • WordPress Version: WordPress 2.8.x
  • Theme Name: Custom
Modifying add_post_meta and $post_views
« on: 01 December 2009, 00:16 »
Hi Lester,


Thanks for a great plugin. Two questions:

1) How can I hide the custom field for views in the posts section? I've tried editing the following (which worked for other plugins) with no success:

add_post_meta($id, 'views', 1, true)

add_post_meta($id, '_views', 1, true)

2) I realise you can change the value after $post_views+x to inflate post views.

if(!update_post_meta($id, 'views', ($post_views+1))) {

Is this limited to integers, or is there any way to use decimals (i.e. 1.2) and have the post view display an integer? i.e.


1 x 3 = 3 (3 views)
1.2 x 3 = 3.6 (4 views)


Thankyou,


Andrew

Offline GaMerZ

  • lesterchan.net
  • Administrator
  • *****
  • Posts: 11,536
    • View Profile
  • WordPress Version: WordPress 2.9.x
  • Theme Name: lesterchan.net v3.4
Re: Modifying add_post_meta and $post_views
« Reply #1 on: 01 December 2009, 04:41 »
1. You are correct adding an underscore in front will hide it, but you need to do it for every add, update and delete post meta functions
2. It will except only integer as in whole numbers because i intval() the value.

++ lesterchan.net - Lester Chan's Website

I regret to say that I am not able to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.