Home>Support>Query using custom date/time field in Post Loop

Query using custom date/time field in Post Loop

Used ACF date and time plugin to add custom field for Auction Date and Time. I want to order the posts by this field. I have tried the Post Loop widget with the following to no avail:
meta_key=auction_date_time&orderby=meta_value&meta_compare=>=&meta_value=’.date(‘d/m/Y H:i’).’&order=ASC
It does seem to order them by the date and time; however, I was wanting to also remove auctions older than the current date. I tried using the meta_compare above but it still pulls all the posts. Any help with this would be greatly appreciated.

Thanks,
James

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 7 years, 4 months ago Alex S
    Hi, I Work Here

    Hi Jamecky

    Unfortunately, this isn’t possible with the post loop widget at this time due to the usage of PHP. You can get around this by using a filter, however. If you’re using just SitORigin Page Builder, you can use the siteorigin_panels_postloop_query_args filter. If you’re using the SitOrigin Widgets Bundle, use siteorigin_widgets_posts_selector_query.

    You can get the current post by checking post__not_in which will always contain the current post id as the first id.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More