Adds 2nd header under primary header
-
I want to replace the standard header that appears on every page in my site with a custom header on specific pages.
Currently this plugin is simple adding the featured image as an additional header.
Am I missing something?
https://www.ads-software.com/plugins/genesis-custom-headers/
-
I do see where I can add the header in all manner of places, but I can’t see any way to replace the default header.
It always Adds a header, but never replaces the header that is already there.
To be clear, I’d like to have a standard header that shows up on all pages without having to customize each page.
But I want to then “replace” that header image with the featured image on specific pages.
Thanks
Hello Explorz,
Unfortunately, this plugin only “adds”, it doesn’t “remove” anything. This is by design since it is impossible to know how every individual theme is constructed. And we also don’t want to remove anything we shouldn’t.
I am guessing that your theme is including this default header on all pages. The easiest way to stop this from happening would be to identify the
id
orclass
of the default header container and then add something like.default-header-class { display: none }
, or alternatively#default-header-id { display: none }
, to your site’s main CSS file. If you give me some more details (i.e. your site url if it is live), I might be able to help you out further.Thanks,
NickI did put in css code to not display the header on any pages. However, certain pages like archive pages, now don’t have any header and I don’t see any way to have this plugin add a header to the archive pages.
Seems there must be a way to not have double headers on all pages And have a header on my archive pages.
Hello Explorz,
This plugin only adds custom header to pages, posts, and custom post types. The current version of the plugin does not allow you to add custom headers to archive pages, 404 pages, search pages, etc.
The best way to achieve what you are looking for is to alter the core functionality (PHP) of your theme. However, there is a CSS workaround, but it might be a little labor intensive. As I mentioned before you can do
.default-header-class { display: none }
, but we can go a step further and make this page specific.If you look at the source of your site, when you are on a page or post, in the
<body>
you will see the post/page class id. It should look something likepage-id-xxx
. So then we can alter our CSS to be.page-id-xxx .default-header-class { display: none }
. This will only turn off the default header on that page. I hope this helps.Thanks!! Editing the php function or the CSS is no problem.
I would like all of my archive pages to show the normal header that my theme wants to show and all other pages to hide the header so that I can instead put in a custom header using your plugin.
I have a lot more pages that I would like to add the custom header and only a few archive pages that I would like the standard header to show.
The site is live but currently using my old theme and not the Genesis Dynamik theme with which I am using your plugin.
The site is https://www.chessedwards.com
Might you be able to supply me with the code the hide the header image on all pages except the archive pages?
Thanks again.
Hi Explorz,
Unfortunately, I have never used the Genesis Dynamik theme. I know my way around pretty much all of the StudioPress Genesis themes: https://my.studiopress.com/themes/, but not Dynamik. There is no “stock” code that will disable the default headers on specific pages. I would need go through all the PHP files that make up the Dynamik theme to isolate the custom function they are using to display the default headers.
In quickly researching the Dynamik theme, I stumbled upon their forum: https://cobaltapps.com/forum/. You cannot be the first person that wanted to disable the default header on certain pages. Perhaps someone in their forum will know the answer for that specific theme.
Hi,
I am sure that the code to enable the header on only archive pages (all archive pages with a single setting) is generic to the Genesis theme.
Might you know that code. It is something around a conditional that says:
if it isn’t an archive page, then remove the header. Then all pages would have the header removed except the archive pages. The archive pages are the pages that show all the posts under a specific category.
If you can help, that’s great. If I’m asking for something that is beyond your knowledge, I totally understand.
I did find this page that may help me out.
https://wpsites.net/web-design/remove-header/Sorry that my coding is quite rudimentary. I think that you were close to it in the code you kindly provided up top.
Also, I’m Curious how your plugin functions on other genesis themes. Does this issue of your plugin creating double headers not an issue with most themes? I’d imagine that in most themes you designate a header to populate across your site. How does your plugin not then double up headers in those themes like it is doing in mine?
Perhaps I am confused about what you mean by “header”. Most Genesis themes, at least the ones made by StudioPress, do not have header images or content on each page (there are some exceptions, see below). The Genesis Framework is a good example: https://my.studiopress.com/themes/genesis/#demo-full. They do however, have headers with the site name, navigation bar, header widget area, etc. The code in the link that you provided will remove this area from the site, not any default headers that your theme includes. To the best of my knowledge, default headers are not a standard component of Genesis, especially since the Genesis Framework Theme does not have them.
Now of course certain themes have default headers (or header banners), one example is the Beautiful Theme: https://my.studiopress.com/themes/beautiful/#demo-full. This is custom to this theme and the activation function looks like:
//* Hook site header banner after header add_action( 'genesis_after_header', 'beautiful_site_header_banner' ); function beautiful_site_header_banner() { if ( ! get_background_image() ) return; echo '<div class="site-header-banner"></div>'; }
Now to remove this from single pages, posts, etc. but still have it show on archive pages and whatnot, you would do:
//* Hook site header banner after header if ( ! is_singular ) { add_action( 'genesis_after_header', 'beautiful_site_header_banner' ); } function beautiful_site_header_banner() { if ( ! get_background_image() ) return; echo '<div class="site-header-banner"></div>'; }
So unfortunately there is no single way to remove these default banners/headers since they are custom functions in each theme. But if you isolate the function that is displaying them, the
if ( ! is_singular )
technique should work.My plugin was primarily designed for all the themes that don’t offer custom headers/banners by default, or for those that are building their own Genesis child themes and want the ability to have custom headers contained in a plugin. I do this for all my clients. Let me know if I can help in any other way.
Hello Explorz,
Since I have not heard back from you I am going to mark your post as “resolved”. If I can assist you with anything else, please feel free to create another support thread.
Thanks,
NickHey Nick,
I was out of town for a few days. Unfortunately we’re still not quite resolved.
What I mean by header is the header image I chose to show up site wide. The Genesis theme has the function laity to choose either the “Header” or a “Header Image”. I have selected the setting to use a Header Image and then chose the image from my media library.
Perhaps your plugin is only coded to work with a standard header and not a header image. They are two different things and the user has the option to choose to use a header (with the site name and description) or a header image chosen from the media library.
It might be cool to modify the plugin to that instead of only adding to a header, it can replace a header image that has been set to show site wide.
This was baked into the old twenty eleven theme I was using. One chooses a header image to show site wide. But on individual pages or pasts one simply checks a box that says, Use the featured image INSTEAD of the default image on this page. That leaves the default image in tact across the site except on the pages what one checks that box.
That’s what I assumed this plugin would do rather than add to the current header image.
Does this provide any more insight that may help find a solution?
Thanks
Hi Explorz,
Thank you for this additional information, I now fully understand. You are correct in that this plugin was not built to take these factors into account, since not every Genesis theme adds a header image.
That said, you are not the first person who has asked about it, so I have added this to my todo list for the next iteration of this plugin. However, it is not a trivial addition since it takes the plugin in a direction I had not originally intended, and I need to make sure it integrates seamlessly. I do not currently have a timeframe for this, but I will make sure to address it in the future.
In the meantime, if you want to use this plugin for custom headers, I would suggest using the code in my previous response to disable the default header banner image on single posts and pages.
Thans Nick,
I’m so close to getting this to work. The only thing I can’ figure out is the exact coed for my theme to not display the site header on singular posts and pages, but display it everywhere else.
Using the Dynamik child theme for Genesis, I know that the site header is called out as: .site-header
But I can’t figure out the code for the add action and function.
I think that if I could just get the site header to stop showing up on the singular pages, then I could use your plugin to put my custom header images on all my singular pages and posts.
Nick, I have a possible idea. Not at all sure if it can be implemented.
It seems that in my choices for where to put the header I can’ choose to simply replace the site header with the featured image.
I know that you can’t create a filter that will be applicable to every theme and child theme.
but can you include a text area where we might be able to write in the code that we know works for our theme?
For example, using Dynamik I want to use the featured image to completely replace the site image. I think that the code for the site image is .site-header
So, perhaps an option to replace and then a text box to input “.site-header.
Again, I have no idea if that is doable, but perhaps?
Thanks.
Sorry I have been traveling. Not sure why I did not think of this before but you could probably use the Raw Content field. If you do not see this field on posts/pages, go to the plugin settings page to enable it. The Raw Content field will accept pretty much anything except PHP, so you could do something with CSS like:
<style> .site-header { display: none; } </style>
You might need to modify this according to the HTML markup of you site, but this will hide the header on the post/page you apply it to.
I understand this might not be the most optimal solution, but it should work before I get to updating the plugin as a whole.
Let me know if this works for you.
- The topic ‘Adds 2nd header under primary header’ is closed to new replies.