I am currently using WordPress to build my portfolio website. The site consists of:
- a homepage showing “project” posts (using post categories).
- an about us page
- a projects page (very similar to homepage) showing thumbnails and titles of recent projects.
- a project detail page (this is a click through from either the homepage or projects page and shows detail on a particular project.
On the project detail page I have an image slider which I want to show the work associated with that project. I have used the following function call to return all images associated with the post:
<?php display_images_in_list('medium'); ?>which calls the following function:
function display_images_in_list($size = thumbnail) {
if($images = get_posts(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => -1, // show all
'post_status' => null,
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'ASC',
))) {
foreach($images as $image) {
$attimg = wp_get_attachment_image($image->ID,'medium');
echo "<div class='slide'>".$attimg."</div>";
}
}
}
Even though I have specified I would like medium images returned my slider still features the thumbnail image which I uploaded to show on another page.
How can I show only medium images?
when you upload image as attachment to post wp creates thumbnails. You cannot upload a thumbnail. If you upload big image, and thumb image both will be shown. You need to upload only big images and than it will show medium size as you wish.