Remove default header images and load custom header images from 'The Headers' page. Allows for easy selection of random header images in you …
Remove default header images and load custom header images from ‘The Headers’ page. Allows for easy selection of random header images in your theme.
A plugin that should be able to remove default headers for a theme and add custom headers based upon the article written by Julio Biason who was inspired by wpti.ps.
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.
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-images
directory to the /wp-content/plugins/
directoryAppearance > Header
or Customize > Header Image
and select Randomize
from the Default Images section.wp_get_attachment_image()
to populate specific attributesget_page_by_title()
plugins_loaded
after_theme_setup
filterload_plugin_textdomain()
wp_get_attachment_url()
, thanks @poulhget_children()
after_theme_setup
hook on front endafter_theme_setup
hook to use later priority to ensure $_wp_default_headers is set, fixes removal of default imagessrcset
needs to be set correctly in header.php
strong
tag in error messageremove_default_header_images
to run only if The Headers page is present. Should fix a PHP Notice too.deactivate_plugins
to and just display an error notice for better compatibility.