Created
November 27, 2012 04:22
-
-
Save caratage/4152357 to your computer and use it in GitHub Desktop.
check if post has image attachment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$attachments = get_children ( | |
array ( | |
'post_parent' => get_the_ID(), | |
'post_type' => 'attachment', | |
'post_mime_type' => 'image' | |
) | |
); | |
if ( $attachments ) { | |
// do conditional stuff here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment