Forums

Adding and EITHER OR statement in an $args array (2 posts)

  1. Mediatricks
    Member
    Posted 3 years ago #

    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!

  2. popart
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic