0
votes

I am using visual composer in WordPress,In the i have create the custom post type for the event and displaying the events such as upcoming event and past event using grid builder.the upcoming event is displaying fine but the past event is showing all post,I need to display only the past events i have try some methods in that i have write the custom query for the past event to comparing with current date. Custom field name:

date_short_order

Custom query:

post_type=event&posts_per_page=3&post_status=publish&meta_key=date_short_order&orderby=meta_value_num&order=DESC&meta_query%5B0%5D%5Bkey%5D=date_short_order&meta_query%5B0%5D%5Bvalue%5D=$today&meta_query%5B0%5D%5Bcompare%5D=<&meta_query%5B0%5D%5Btype%5D=DATE

I am struggling past one week with this any one help me.

1
Yow Ravi Ji sathiyama theriyathu ya.. ;)Ramesh S
@Ravi first clearly post your query then only we will answerSamyappa
i have explain every thing here,Ravi Kumar
post_type=event&meta_query%5B0%5D%5Bkey%5D=date_short_order&meta_query%5B0%5D%5Bvalue%5D=2017-06-16&meta_query%5B0%5D%5Bcompare%5D=%3C&meta_query%5B0%5D%5Btype%5D=DATE post_type=event&meta_query%5B0%5D%5Bkey%5D=date_short_order&meta_query%5B0%5D%5Bvalue%5D=2017-06-16&meta_query%5B0%5D%5Bcompare%5D=%3C&meta_query%5B0%5D%5Btype%5D=DATE i have got the result with this query. but how to get the current date??Ravi Kumar

1 Answers

0
votes

Finally i got answer.

post_type=event&meta_query%5B0%5D%5Bkey%5D=date_short_order&‌​meta_query%5B0%5D%5B‌​value%5D=$today&‌​meta_query%5B0%5D%5B‌​compare%5D=%3C&meta_‌​query%5B0%5D%5Btype%‌​5D=DATE post_type=event&meta_query%5B0%5D%5Bkey%5D=date_short_order&‌​meta_query%5B0%5D%5B‌​value%5D=$today&‌​meta_query%5B0%5D%5B‌​compare%5D=%3C&meta_‌​query%5B0%5D%5Btype%‌​5D=DATE