Default custom_header image not used on my theme
-
Hello!
For a theme-framework project of mine, I am currently trying to implement the custom-header functionality of the theme custimizer.
I got everything up and running, but I have a very strange problem with setting the default image. As suggested in several help and support pages, I setup the custom-header as follows:
add_theme_support("custom-header", array("default-image" => get_template_directory_uri()."/images/defaultlogo.png", "flex-width" => true, "flex-height" => true, "width" => 230, "height" => 70, "uploads" => true);
So far, so good. When opening the theme customizer, I have the section “Header Image”, where I can choose the custom header. I get the resolution-suggestion of 230x70px, can upload an image and even choose the default image (thumbnail of it to click on) to replace a previously selected one.
The problem is the last of these features: I can click on the default-image, then it is shown in the preview. But as soon as I view the website outside of the theme customizer, the old image is used instead of the default one I picked. It looks like I can not revert to default.
Function that is called in “header.php”:
function useCustomHeader() { [...] return "<img src=\"".get_header_image()."\" width=\"".get_custom_header()->width."\" height=\"".get_custom_header()->height."\" />"; }
Do you know what is wrong with my code? Did I miss anything?
Thanks in advance,
JonathanEdit:
By luck, I found a way to get the default image back (even though this is not a solution, since it is too complicated for providing it to end-users):1. Set Header Image to “Random”.
2. Save
3. Click Button to Hide Header Image
4. Save
5. Choose Default Header Image
6. Save
- The topic ‘Default custom_header image not used on my theme’ is closed to new replies.