johnbillion / extended-cpts

A library which provides extended functionality to WordPress custom post types and taxonomies.
GNU General Public License v2.0
979 stars 96 forks source link

admin_cols meta_key modify displayed value #61

Closed sandrodz closed 7 years ago

sandrodz commented 7 years ago
screen shot 2017-06-07 at 10 03 27 am screen shot 2017-06-07 at 10 04 20 am

I want following logic: a. if status = 0 display created b. if status = 1 display claimed

I want to use callback function as stated in docs, but Wiki says that I need to use global $post here, seems excessive to do all the postmeta query manually. Is there a better way?

johnbillion commented 7 years ago

You can use get_post_meta( get_the_ID(), 'gift_order_status', true ) from within your call back function to get the meta value. This won't cause any extra database queries because it gets pre-cached by WordPress when the posts are fetched.

sandrodz commented 7 years ago

No need. I did following:

screen shot 2017-06-07 at 2 44 19 pm