Skip to main content
deleted 859 characters in body
Source Link
pixeline
  • 2.9k
  • 7
  • 34
  • 44

update

$args = array(
    'meta_key'          => 'event_date_start_id',
    'category_name'     => 'private',
    'order'             => 'ASC',
    'orderby'           => 'meta_value',
    'meta_query'        => array(
        'relation' => 'OR',
        array(
            //event_date_start_id greater or equal to $since
            'key' => 'bjab_event_date_start_id',
            'value' => $since,
            'type' => 'numeric',
            'compare' => '>='
        ),
        array(
            //event_date_end_id greater or equal to $since
            //and event_date_start_id lower than $since
            // and event_date_start_id != ""
            'relation' => 'AND',
            array(
                'key' => 'bjab_event_date_end_id',
                'value' => $since,
                'type' => 'numeric',
                'compare' => '>='
            ),
            array(
                'key' => 'bjab_event_date_end_id',
                'compare' => 'NOT EXISTS'
            )
        )
    )
);

update

$args = array(
    'meta_key'          => 'event_date_start_id',
    'category_name'     => 'private',
    'order'             => 'ASC',
    'orderby'           => 'meta_value',
    'meta_query'        => array(
        'relation' => 'OR',
        array(
            //event_date_start_id greater or equal to $since
            'key' => 'bjab_event_date_start_id',
            'value' => $since,
            'type' => 'numeric',
            'compare' => '>='
        ),
        array(
            //event_date_end_id greater or equal to $since
            //and event_date_start_id lower than $since
            // and event_date_start_id != ""
            'relation' => 'AND',
            array(
                'key' => 'bjab_event_date_end_id',
                'value' => $since,
                'type' => 'numeric',
                'compare' => '>='
            ),
            array(
                'key' => 'bjab_event_date_end_id',
                'compare' => 'NOT EXISTS'
            )
        )
    )
);
added code's latest version.
Source Link
pixeline
  • 2.9k
  • 7
  • 34
  • 44

update

$args = array(
    'meta_key'          => 'event_date_start_id',
    'category_name'     => 'private',
    'order'             => 'ASC',
    'orderby'           => 'meta_value',
    'meta_query'        => array(
        'relation' => 'OR',
        array(
            //event_date_start_id greater or equal to $since
            'key' => 'bjab_event_date_start_id',
            'value' => $since,
            'type' => 'numeric',
            'compare' => '>='
        ),
        array(
            //event_date_end_id greater or equal to $since
            //and event_date_start_id lower than $since
            // and event_date_start_id != ""
            'relation' => 'AND',
            array(
                'key' => 'bjab_event_date_end_id',
                'value' => $since,
                'type' => 'numeric',
                'compare' => '>='
            ),
            array(
                'key' => 'bjab_event_date_end_id',
                'compare' => 'NOT EXISTS'
            )
        )
    )
);

update

$args = array(
    'meta_key'          => 'event_date_start_id',
    'category_name'     => 'private',
    'order'             => 'ASC',
    'orderby'           => 'meta_value',
    'meta_query'        => array(
        'relation' => 'OR',
        array(
            //event_date_start_id greater or equal to $since
            'key' => 'bjab_event_date_start_id',
            'value' => $since,
            'type' => 'numeric',
            'compare' => '>='
        ),
        array(
            //event_date_end_id greater or equal to $since
            //and event_date_start_id lower than $since
            // and event_date_start_id != ""
            'relation' => 'AND',
            array(
                'key' => 'bjab_event_date_end_id',
                'value' => $since,
                'type' => 'numeric',
                'compare' => '>='
            ),
            array(
                'key' => 'bjab_event_date_end_id',
                'compare' => 'NOT EXISTS'
            )
        )
    )
);
added 776 characters in body
Source Link
pixeline
  • 2.9k
  • 7
  • 34
  • 44
    $since = date('Y-m-d');
    $args = array(
    'meta_key'          => 'event_date_start_id',
    'category_name'     => 'private',
    'post_type''order'             => 'post''ASC',
    'post_status''orderby'           => 'publish''meta_value',
    'order''meta_query'        => array(
        'relation' => 'ASC''OR',
    'meta_key'    array(
            //event_date_start_id greater or equal to $since
            'key' => 'event_date_start_id''bjab_event_date_start_id',
    'orderby'        'value' => $since,
            'type' => 'meta_value''numeric',
    'meta_query'         'compare' => '>='
        ),
        array(
             //event_date_end_id greater or equal to $since
             //and event_date_start_id lower than $since
             // and event_date_start_id != ""
            'relation' => 'OR''AND',
             array(
                'key' => 'event_date_start_id''bjab_event_date_start_id',
                'value' => $since,
                'type' => 'numeric',
                'compare' => '>=''<'
             ),
             array(
                'key' => 'event_date_end_id''bjab_event_date_end_id',
                'value' => $since,
                'type' => 'numeric',
                'compare' => '>='
            ),
             array(
                'key' => 'bjab_event_date_end_id',
                'value' => '',
                'type' => 'numeric',
                'compare' => '!='
            )
        )
    )
);

    $query = new WP_Query( $args );
$since = date('Y-m-d');
$args = array(
    'category_name'     => 'private',
    'post_type'         => 'post',
    'post_status'       => 'publish',
    'order'             => 'ASC',
    'meta_key'     => 'event_date_start_id',
    'orderby'           => 'meta_value',
    'meta_query'        => array(
        'relation' => 'OR',
        array(
            'key' => 'event_date_start_id',
            'value' => $since,
            'type' => 'numeric',
            'compare' => '>='
        ),
        array(
            'key' => 'event_date_end_id',
            'value' => $since,
            'type' => 'numeric',
            'compare' => '>='
        )
    )
);

$query = new WP_Query( $args );
    $since = date('Y-m-d');
    $args = array(
    'meta_key'          => 'event_date_start_id',
    'category_name'     => 'private',
    'order'             => 'ASC',
    'orderby'           => 'meta_value',
    'meta_query'        => array(
        'relation' => 'OR',
        array(
            //event_date_start_id greater or equal to $since
            'key' => 'bjab_event_date_start_id',
            'value' => $since,
            'type' => 'numeric',
             'compare' => '>='
        ),
        array(
             //event_date_end_id greater or equal to $since
             //and event_date_start_id lower than $since
             // and event_date_start_id != ""
            'relation' => 'AND',
             array(
                'key' => 'bjab_event_date_start_id',
                'value' => $since,
                'type' => 'numeric',
                'compare' => '<'
             ),
             array(
                'key' => 'bjab_event_date_end_id',
                'value' => $since,
                'type' => 'numeric',
                'compare' => '>='
            ),
             array(
                'key' => 'bjab_event_date_end_id',
                'value' => '',
                'type' => 'numeric',
                'compare' => '!='
            )
        )
    )
);

    $query = new WP_Query( $args );
added 67 characters in body
Source Link
pixeline
  • 2.9k
  • 7
  • 34
  • 44
Loading
Source Link
pixeline
  • 2.9k
  • 7
  • 34
  • 44
Loading