Kriuchko
1/8/2019 - 12:52 PM

Post blog post attached images

Wordpress post attached images

function get_attachments($post_id)
{
 $args = array('post_type' => 'attachment',
      'orderby' => 'menu_order',
      'order' => 'ASC',
      'post_mime_type' => 'image',
      'exclude' => get_post_thumbnail_id(),
      'post_parent' => $post_id);

 $attachments = get_children($args);

if (is_array($attachments) && count($attachments))
{
	foreach($attachments as $attachment)
	{
		echo '<li><img src="' . $attachment->guid . '" alt="image description" /></li>';
	}
}

}

function get_attachments_selectedwork_big($post_id)
{
 $args = array('post_type' => 'attachment',
      'orderby' => 'menu_order',
      'order' => 'ASC',
      'post_mime_type' => 'image',
      'post_parent' => $post_id);

 $attachments = get_children($args);

if (is_array($attachments) && count($attachments))
{
	foreach($attachments as $attachment)
	{

		$attachmentimage = wp_get_attachment_image($attachment->ID, 'single-selected-work-big' );

		echo '<div class="slideshow-item">';
			echo $attachmentimage;
		echo '</div>';
	}
}
}