Home › Forums › General Issues › Show only upcoming events from current month › Reply To: Show only upcoming events from current month
<?php $today = date('Y-m-d'); $last_of_month = date('Y-m-t'); $args = array( 'posts_per_page' => 7, 'post_type' => 'competicions', 'orderby' => 'meta_value', 'order' => 'asc', 'meta_key' => 'datahora_prova', //ACF date field 'meta_query' => array( array( 'key' => 'datahora_prova', 'value' => $today, 'compare' => '>=', 'type' => 'DATE' ), array( 'key' => 'datahora_prova', 'value' => $last_of_month, 'compare' => '<=', 'type' => 'DATE' ) ) );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.