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:


Custom query:


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

  • I have find the solution but not exactly – Ravi Kumar Jun 17 '17 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 '17 at 10:15

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, privacy policy and cookie policy

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