Attachment Help
-
Hello,
I’m currently using the following to display attachments:
<?php global $wpdb; $attachment_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_status = 'inherit' AND post_type='attachment' ORDER BY post_date DESC LIMIT 1"); ?> <?php the_attachment_link($attachment_id); ?>
Is there an if statement I could use where if there is an attachment display the above code I posted, and if there isn’t an attachment display nothing?
- The topic ‘Attachment Help’ is closed to new replies.