Home Forums ACF PRO Show 4 page titles based on next dates Reply To: Show 4 page titles based on next dates

  • For doing custom queries in WP you will want to learn WP_Query

    ACF saves dates as YYYYMMDD

    Then you do a WP_Query using the field name of your ACF field in a meta_query

    The query below uses a new feature in WP that’s not in the codex yet and is explained here

    // if this isn't in a template that already have the global $post
    // available you may need to do
    // global $post;
    $today = date('Ymd');
    $args = array(
        'post_type' => 'page', // or your post type
        'posts_per_page' => 4, // the number of posts you want to show
        'meta_query' => array(
            'date_clause' => array(
                'key' => 'name_of_date_field',
                'value' => $today,
                'compare' => '>='
        'order_by' => array(
            'date_clause' => 'ASC',
            'title' => 'ASC',
    $query = new WP_Query($args);
    if ($query->have_posts()) {
        // loop to show what was returned in query

    For more information on queries and loops see the codex page I linked to above.