Skip to main content
added 1 character in body
Source Link
kosher
  • 260
  • 2
  • 11

I think you are asking how to exclude the current exhibition from your upcoming exhibitions query.

If that is the case, simply insert the ID of the current exhibition into the query using 'post_not_in''post__not_in':

$exhibition_upcoming_query = array(
  'post_type' => 'exhibition',
  'orderby' => 'meta_value',
  'order' => 'ASC',
  'posts_per_page' => 3,
  'post__not_in' => array( $exhibition_current_loop->posts[0]->ID ),
  'meta_query' => array(
        array(
          'key' => 'exhibition_start_date',
          'value' => date('Y-m-d'),
          'compare' => '>',
          'type' => 'DATE',
        )
      ),
  );

Hit me up if I am misunderstanding what you are after.

I think you are asking how to exclude the current exhibition from your upcoming exhibitions query.

If that is the case, simply insert the ID of the current exhibition into the query using 'post_not_in':

$exhibition_upcoming_query = array(
  'post_type' => 'exhibition',
  'orderby' => 'meta_value',
  'order' => 'ASC',
  'posts_per_page' => 3,
  'post__not_in' => array( $exhibition_current_loop->posts[0]->ID ),
  'meta_query' => array(
        array(
          'key' => 'exhibition_start_date',
          'value' => date('Y-m-d'),
          'compare' => '>',
          'type' => 'DATE',
        )
      ),
  );

Hit me up if I am misunderstanding what you are after.

I think you are asking how to exclude the current exhibition from your upcoming exhibitions query.

If that is the case, simply insert the ID of the current exhibition into the query using 'post__not_in':

$exhibition_upcoming_query = array(
  'post_type' => 'exhibition',
  'orderby' => 'meta_value',
  'order' => 'ASC',
  'posts_per_page' => 3,
  'post__not_in' => array( $exhibition_current_loop->posts[0]->ID ),
  'meta_query' => array(
        array(
          'key' => 'exhibition_start_date',
          'value' => date('Y-m-d'),
          'compare' => '>',
          'type' => 'DATE',
        )
      ),
  );

Hit me up if I am misunderstanding what you are after.

Source Link
kosher
  • 260
  • 2
  • 11

I think you are asking how to exclude the current exhibition from your upcoming exhibitions query.

If that is the case, simply insert the ID of the current exhibition into the query using 'post_not_in':

$exhibition_upcoming_query = array(
  'post_type' => 'exhibition',
  'orderby' => 'meta_value',
  'order' => 'ASC',
  'posts_per_page' => 3,
  'post__not_in' => array( $exhibition_current_loop->posts[0]->ID ),
  'meta_query' => array(
        array(
          'key' => 'exhibition_start_date',
          'value' => date('Y-m-d'),
          'compare' => '>',
          'type' => 'DATE',
        )
      ),
  );

Hit me up if I am misunderstanding what you are after.