| name | language | licence |
|---|---|---|
| Current Page Item | PHP | BSD |
| DISPLAY THE FIRST IMAGE ATTACHMENT OF A WORDPRESS POST | PHP | BSD |
| WORDPRESS TEMPLATE URL | PHP | BSD |
| WORDPRESS BLOG URL | PHP | BSD |
| WORDPRESS INCLUDE FILE | PHP | BSD |
| WORDPRESS GET TITLE OR ALT. TITLE | PHP | BSD |
| Wordpress Categories Nav | PHP | BSD |
| Make header image clickable | PHP | BSD |
< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 >
language: PHP
licence: BSD
DISPLAY THE FIRST IMAGE ATTACHMENT OF A WORDPRESS POST
options: view full snippet • send to code collector
<?php
$attachments = get_children(array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order'));
if ( ! is_array($attachments) ) continue;
$count = count($attachments);
$first_attachment = array_shift($attachments);
?>
<?php echo wp_get_attachment_image($first_attachment->ID); ?>



library
buttons (3)
wp (93)