WordPress: Get or Query All Header Images

This is your friend:

$headers = get_uploaded_header_images();

Simple PHP looping example:

<?php foreach($headers as $header) { ?>
<img src="<?php echo $header['url']; ?>" />
<?php } ?>

If you want to get all the uploaded header images to make a slideshow that requires no extra plugins, use this function to get an array of images to loop through. Your client can easily add and crop new images in the Appearance -> Header section of your admin.

Working with WordPress 3.3.1 and the twentyeleven theme, just for reference.


To make your header image show at random add this line:

$headers = get_uploaded_header_images();