Title: Adding and EITHER OR statement in an $args array
Last modified: August 19, 2016

---

# Adding and EITHER OR statement in an $args array

 *  [Mediatricks](https://wordpress.org/support/users/mediatricks/)
 * (@mediatricks)
 * [18 years ago](https://wordpress.org/support/topic/adding-and-either-or-statement-in-an-args-array/)
 * I am trying to call a list of all IMAGES stored as posts in the WP database. 
   The array below will only show me uploaded jpgs.
 * If I delete the post_mime_type line I get ALL attachments (but that includes 
   icons, video mp3 etc.)
 * I want to see only gif, jpg and png attachments returned but can’t seem to find
   any way to add a conditional element to the array.
 * $args = array(
    ‘post_type’ => ‘attachment’, ‘numberposts’ => 20, ‘post_status’
   => null, ‘post_parent’ => $page, // Post number ‘post_mime_type’ => ‘image/jpeg’,//
   Need to add an OR statement ??? ‘order’ => ‘DESC’, ); $attachments = get_posts(
   $args);
 * Please can someone help me!

Viewing 1 replies (of 1 total)

 *  [modern](https://wordpress.org/support/users/popart/)
 * (@popart)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/adding-and-either-or-statement-in-an-args-array/#post-777967)
 * I also need to add a conditional statement to an array. I’m using this same code
   to put attachments on my home page. But I only want to pull attachments from 
   specific categories.

Viewing 1 replies (of 1 total)

The topic ‘Adding and EITHER OR statement in an $args array’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [images](https://wordpress.org/support/topic-tag/images/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [modern](https://wordpress.org/support/users/popart/)
 * Last activity: [17 years, 11 months ago](https://wordpress.org/support/topic/adding-and-either-or-statement-in-an-args-array/#post-777967)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
