I’m developing a photo gallery WP site. I would like to add “ul” list of images that are randomly picked from the gallery.
How would I randomly pick a number of images from the media library.
Any pointers would be greatly appreciated.
I’m developing a photo gallery WP site. I would like to add “ul” list of images that are randomly picked from the gallery.
How would I randomly pick a number of images from the media library.
Any pointers would be greatly appreciated.
You must be logged in to post a comment.
Adding the following to your theme’s functions.php file will let you use a shortcode (
[wpse73055-random-images]
) with an optionalnum
parameter (i.e.[wpse73055-random-images num=5]
to display 5 random images).wp_get_attachment_link
WP_Query
add_shortcode