Support

Account

Home Forums Front-end Issues Sorting using ACF Date field with Elementor Grid

Unread

Sorting using ACF Date field with Elementor Grid

  • Best

    I am currently using this code for my event page:

    function dd_query_by_event_date( $query ) {
    $query->set( 'orderby', 'meta_value' );
    $query->set( 'meta_key', 'start_date' );
    $query->set( 'meta_query', array(
    array(
    'key' => 'start_date',
    'value' => date( 'Y-m-d' ),
    'compare' => '>=',
    'type' => 'DATETIME',
    ),
    ) );
    }
    add_action( 'elementor/query/dd_event_date', 'dd_query_by_event_date' );

    and then load this via the query at Elementor Pro so that the grid is sorted accordingly. However, the above script also removes all multi-day events on the starting day

    I also saw this on this forum:
    https://support.advancedcustomfields.com/forums/topic/sorting-using-acf-date-field/#post-170900

    However, I cannot get this to work, I think this has to do with the fact that this code is built on the basis of a page and not on the basis of a function script

    Who can help me with this ?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.