I am using Post Grid to display post types "Event" which has a meta key "event-start-date". I can force it to hide past events by passing in:
Key: event-start-date
Value: 1582691760 (unix timestamp for 26/FEB/2020)
Compare: >
Type: event (post type)
However, I need the "value" to be dynamically determined and was hoping to use something like "$today" or something of that equivalent.
Can you please advise the best way I can use your Post Grid plugin to filter my custom post type by the meta field "event-start-date"?
Welcome to our forum.
Yes, we have a solution for this, meta value field has shortcode support to pass dynamic values like you want, please use following shortcode into meta value field,
2024-03-28
https://imgur.com/deOROro
it will return date following format Y-m-d
in case you need to different date output you can use different shortcode define by you, simple rename following function to generate your shortcode
add_shortcode('post_grid_today_date','post_grid_today_date_20200228'); function post_grid_today_date_20200228(){ return date('Y-m-d'); }
Hope that help you.
Regards
Hello, I have same problem and shortcode solution is not working for me. Shortcode itself return current date but not working in post grid Advance Query!
Regards