add_shortcode("contest-thumbnails", "show_all_thumbs"); function show_all_thumbs() { global $post; $post = get_post($post); /* image code */ remove_all_filters('posts_orderby'); $images =& get_children( 'post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=rand&post_parent='.$post->ID); if($images){ foreach( $images as $imageID => $imagePost ){ unset($the_b_img); $the_b_img = wp_get_attachment_image($imageID, 'thumbnail', false); $thumblist .= ''.$the_b_img.''; } } return $thumblist; }