Remove default header images and load custom header images from ‘The Headers’ page. Allows for easy selection of random header images in your theme.
Create a Page named The Headers. Then upload header images (media files) to the the page. The page may have a visibility of private. All images displayed on the page will be parsed, those attached to the page and those added via image blocks.
Once the custom header images are loaded, just go to
Appearance > Header or
Customize > Header Image and select
Randomize suggested headers.
The plugin will display an error notice if there is not a page titled, The Headers.
- Create a new page. It can be private. It must be titled
The Headers. Add any images that you want to use as custom header images to this page. Header images should be cropped appropriately for the base theme.
add-custom-header-imagesdirectory to the
- Activate the plugin through the ‘Plugins’ menu in WordPress
- Go to
Appearance > Headeror
Customize > Header Imageand select
Randomizefrom the Default Images section.
Contributors & Developers
“Add Custom Header Images” is open source software. The following people have contributed to this plugin.Contributors
2.3.3 / 2023-07-21
- use ‘all’ over ‘any’ in query, perhaps better
wp_get_attachment_image()to populate specific attributes
2.3.2 / 2023-02-08
- improve WP_Query for single call
2.3.1 / 2023-02-08
- fix to use public or private pages
2.3.0 / 2023-02-05
- PHP 8.1 compatibility changes
- update for deprecated
- start from
2.2.0 / 2023-01-13
- update GitHub Actions
- update to add alt text to header image
2.1.0 / 2021-07-07
- add @10up GitHub Actions for SVN
2.0.3 / 2020-08-01
- add check for PHP warning
2.0.2 / 2020-03-28
- initialize some variables
2.0.1 / 2020-03-03
- add header image support to theme if none exists
- parse images from page blocks
- refactor class methods
- always load
- correctly initialize
- simplify admin notice
- WPCS compliant
- fixed to use
wp_get_attachment_url(), thanks @poulh
- use WP_Query instead of
- only load
after_theme_setuphook on front end
- update Tested to
- simplify conditional
- don’t run from constructor
- requires PHP 5.3, sorta
- use class variables to hold title and page data to reduce number of calls to database
after_theme_setuphook to use later priority to ensure $_wp_default_headers is set, fixes removal of default images
- removed specific srcset code as it was unnecessary and caused failures.
srcsetneeds to be set correctly in
- fixed malformed closing
strongtag in error message
- escape translations of page name
- added srcset for responsive image sizes
- tested and updated for WP 4.4.0
- tested to 4.3
- load textdomain early so translations work.
- fix readme.txt as plugin name generic
- simplify warning, remove nested if statements
- update .pot
- better i18n strings, updated POT
remove_default_header_imagesto run only if The Headers page is present. Should fix a PHP Notice too.
deactivate_pluginsto and just display an error notice for better compatibility.
- added some error checking
- more graceful exit and return
- exit after deactivating plugin when not able to be activated
- Add .pot files
- Fix short description by removing Markdown
- Initial commit to WordPress repository