1

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.

2
  • I have find the solution but not exactly
    – Ravi Kumar
    Jun 17, 2017 at 10:12
  • I have rewrite the query post_type=event&meta_query%5B0%5D%5Bkey%5D=date_short_order&meta_query%5B0%5D%5Bvalue%5D=2017-06-17&meta_query%5B0%5D%5Bcompare%5D=%3C&meta_query%5B0%5D%5Btype%5D=DATE In this 2017-06-17 the date need to change automatically
    – Ravi Kumar
    Jun 17, 2017 at 10:15

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.