Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // update the events that have a publish status only
- $args = array(
- 'post_type' => 'event',
- 'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash'),
- 'numberposts' => -1,
- 'suppress_filters' => 0,
- );
- /**
- * Since we need to match either one of the meta_queries, set the relation to OR
- */
- if ( !isset( $args['meta_query'] ) ) $args['meta_query'] = array( 'relation' => 'OR' );
- /**
- * NEED This one to select the ones that have recieved a UNIX timestamp at post creation
- */
- $args['meta_query'] = array_merge(
- $args['meta_query'] ,
- array(
- array(
- 'relation' => 'AND',
- array(
- 'key' => 'import_date',
- 'value' => date( 'U' , strtotime("-7 days") ),
- 'type' => 'NUMERIC',
- 'compare' => '<='
- ),
- ),
- ),
- );
- /**
- * This one is needed to select the ones that have been updated or created through the dashboard with an ACF value
- */
- $args['meta_query'] = array_merge(
- $args['meta_query'] ,
- array(
- array(
- 'relation' => 'AND',
- array(
- 'key' => 'import_date',
- 'value' => date( 'Ymd' , strtotime("-7 days") ),
- 'type' => 'DATE',
- 'compare' => '<='
- ),
- ),
- ),
- );
- /**
- * Get the ones that have a ticketstatus of 'just-confirmed'
- */
- $args['tax_query'] = array(
- 'relation' => 'AND',
- array(
- 'taxonomy' => 'ticketstatus',
- 'field' => 'slug',
- 'terms' => array( 'just-confirmed' ),
- 'include_children' => true,
- 'operator' => 'IN',
- ),
- );
- $events = get_posts( $args );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement