Support

Account

Forum Replies Created

  • Figured it out:

      <?php
    $today = date('Ymd');
    $args = array(
        'post_type' => 'hh_event',
        'posts_per_page' => -1,
        'orderby' => 'meta_value',
        'meta_query' => array(
            array(
                'key' => 'event_date',
                'value' => $today,
                'compare' => '>',
            ),
        ),
        'order' => 'ASC',
    
    );
    $the_query = new WP_Query($args);
    ?>
  • Hello, I found this post but it doesn’t work for me. I have custom posts with an ACF date field “event_date”. I post a whole month’s worth of these, but I only want to show the ones with event_date after today (to not show ones that happened already).

    I am using ACF 5.8.7 (not pro).

    My query follows, it shows all events even ones in the past:

     <?php
    // $today = new DateTime(date('Y-m-d'));
    $today = date('Ymd');
    $start_date = date('Ym01');
    $end_date = date('Ymt');
    $meta_query = array(
        'key' => 'event_date',
        'value' => $today,
        'type' => 'numeric',
        'compare' => '>',
    );?>
    
      <?php
    $args = array(
        'post_type' => 'hh_event',
        'posts_per_page' => -1,
        'orderby' => 'meta_value',
        'meta_key' => 'event_date',
        'order' => 'ASC',
    
    );
    $the_query = new WP_Query($args);
    ?>
  • I discovered a major conflict with Easy Bootstrap Shortcodes Pro.

    Once disabled, ACF works fine.

    I reported this to the publishers of EBSP.

Viewing 3 posts - 1 through 3 (of 3 total)