Mostrar imagens anexadas aos posts ou páginas

<?php $argsThumb = array( 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null ); $attachments = get_posts($argsThumb); if ($attachments) { foreach ($attachments as $attachment) { //echo apply_filters('the_title', $attachment->post_title); echo '<img src="'.wp_get_attachment_url($attachment->ID, 'thumbnail', false, false).'" />'; } } ?>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.