Suddenly, when I've installed File Gallery a media tag link appears so, I have a custom query on my site that get 3 random image from the media library.
Now with MEDIA TAG, I would like to get random images within a tag.
This is the query, someone can help me with the syntax?
WORKING OLD QUERY:
wp_reset_query();
$imagesRand = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_mime_type = 'image/jpeg' ORDER BY RAND() LIMIT 3" );
// Random image loop
foreach ($imagesRand as $imageRand) {
$imageScrollID = $imageRand->ID;
echo '' . wp_get_attachment_image( $imageRand->ID, 'thumb-top' ) . '';
}
the result is 3 'ims src=...' images lines
NOT WORKING QUERY:
wp_reset_query();
$imagesRand = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_mime_type = 'image/jpeg' <em>AND slug='topimage'</em> ORDER BY RAND() LIMIT 3" );
// Random image loop
foreach ($imagesRand as $imageRand) {
$imageScrollID = $imageRand->ID;
echo '' . wp_get_attachment_image( $imageRand->ID, 'thumb-top' ) . '';
}
.... THANK YOU VERY MUCH... and sorry for my bad english :)
http://wordpress.org/extend/plugins/file-gallery/