been trying several things but to no avail... Searched, maybe not good enough though!
I have posts that either have an uploaded audio file AND/OR has a Soundcloud link (which is a custom field).
Now I would like to return posts that either have a Soundcloud link, an uploaded file or both.
$arguments = array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'post_mime_type' => 'audio',
'order' => 'DES',
'orderby' => 'parent',
'numberposts' => -1,
);
$attachments = get_posts($args);
Is what I currently use. This of course, returns only posts that have an audio attachment.
I've been trying the 'relation'
and 'meta_query'
options, but failed. Maybe I'm doing something wrong. I think I could do this with 2 different get_posts();
in an if/else statement. But I want to avoid repeating code.
Hope that is clear enough.