In your functions.php
function show_all_thumbs() {
global $post;
$post = get_post($post);
$images =& get_children( 'post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=menu_order&order=ASC&post_parent=".$post->post_parent);
if($images) {
foreach( $images as $imageID => $imagePost ){
unset($the_b_img);
$the_b_img = wp_get_attachment_image($imageID, "thumbnail', false);
$thumblist .= '<a href="'.get_attachment_link($imageID).'">'.$the_b_img.'</a>';
}
}
return $thumblist;
}
In your page template file:
$loop = new WP_Query(
array(
'post_type' => 'demo', // or whatever is called your custom post type
'cat' => 5, // or whatever is the "id" for your custom post type category
'posts_per_page' => 10
)
);
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post();
echo show_all_thumbs();
endwhile;
endif;
Let us know please.
For different/extra questions which have nothing to do with this topic, please ask them separated, starting a new questions thread.
Example for Featured Image version:
$loop = new WP_Query(
array(
'post_type' => 'demo', // or whatever is called your custom post type
'cat' => 5, // or whatever is the "id" for your custom post type category
'posts_per_page' => 10
)
);
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post();
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
endwhile;
endif;