Hey support team !
I saw a lot of publications about the fact that we could add a different header on different pages of the theme. Is it possible to keep the same header styl (7 in my case) on all the site but only change the logo appearing on a page ?
Is there any
if (is_…) fonction that I can add in Header style 7 php ?
Thank you guys,
Pierre Boullier
Hello PierreBoullier,
You can achieve what you want if you use a bit of Css. It is possible this thing without alter your code source. Please try the code below and place it in Theme panel->Custom Css area, like this: http://screencast.com/t/scMiLJl3 .
.td-header-sp-logo {
display: none!important;
}
.home .td-header-sp-logo {
display: block!important;
}
Above, I gave you an example how to display a logo only on your home page. If you want to show the logo to another page, please replace the .home with your page ID. Also, you can find the page ID, using your Inspect element browser, like this: http://screencast.com/t/qPqw9kfOnIUh .
Hope this helps and let us know how it goes!
If is not what you mean, please provide more details about this.
Thank you for message!
Hi @Catalin-l !
Thank you so much for this response. Actually your solution works fine but involves that i only have my header on the home page + another page of my choice but all the other pages don’t display it anymore.
What I want to do is the opposite, I want to display the same header on all my pages except one where I want another header logo or no header at all.
Is there a way to trick the CSS you gave me to achieve this ?
Thank you again,
Let me know if I’m not clear, ill send screenshots to explain it.
Pierre Boullier
-
This reply was modified 10 years by
PierreBoullier.
-
This reply was modified 10 years by
PierreBoullier.
No problem @Catalin-l
So here is the logo header I want to appear on all pages of my website : http://pasteboard.co/2Ew9rL1g.jpg
Except on this page, where I want to chose a different logo header : http://pasteboard.co/2Ew8iX5l.jpg
Hox could I upload a different header to this page but keep the same 1st header on all other pages ?
Hope you understand, I can provide more screenshots if it’s unclear.
Thank you very much,
Pierre Boullier
Hello @PierreBoullier,
If you want to achieve a different header logo on your page, it is necessary to add a set of conditions in header-style file and load a different logo image for each page. Below, I gave you an example for header_style_7.
This code should load a different logo image for the pages but only when header style 7 it’s used. If you change the header style you need to apply the customization in the file corresponding with the header style used. Look here: http://screencast.com/t/jSTSxWh2xdl – http://screencast.com/t/girlnlQWHzE
<?php
if (is_page('PAGE-ID')){
echo '<img src="url image 1">';
}
else {
locate_template('parts/header/logo.php', true);
}
?>
Also, @szmarinov if you want to add a different logo for each category, you have to replace in code above the function is_page with is_category like this: http://screencast.com/t/RDofG5R4YL – http://screencast.com/t/oIF2jUCn
<?php
if (is_category('CATEG ID')){
echo '<img src="url image 1">';
}
elseif (is_category('CATEG ID')){
echo '<img src="url image 2">';
}
else {
locate_template('parts/header/logo.php', true);
}
?>
For more information about function Reference you should see here: https://codex.wordpress.org/Function_Reference/is_page
Hope this helps and let us know how it goes!
Thank you for the message!
Dear @Catalin-l,
It worked really well.
Thank you for your precious help.
Where can i submit a positive review about you ?
Thanks again and have an awesome day,
Pierre Boullier
Hi Catalin.
Sorry to get back in touch with you. The code you provided is working perfectly fine on the header7.php to display a different header on each page on the desktop version. (else if)
Unfortunately on the mobile version, the header is the same everywhere… What can I do to apply the different headers to the mobile version too ?
Also, the header picture is really really small on the mobile version and I do not understand why. Is there any settings I could change or is it linked to the Header 7 style ?
Thanks a lot,
Pierre
Hi
To have a different header for mobile devices you need modify header-menu.php file and add the conditions here: http://screencast.com/t/5ChyQV2Ov
The logo size differ from a header style to another, you can find more details about this in our documentation: https://forum.tagdiv.com/newsmag-logo-favicon/ Its size can be increased with some custom css so please provide your site url so I can take a closer look and maybe i can help you.
Thanks!
Hey @andrei_luca
I found the header-menu.php file, but I don’t figure out what should I change to have my different headers as I have on the desktop version ? Should I change the “true” or “false” values ? Sorry I’m not really into coding.
Here is the link of my website : http://www.questions-de-management.com
As you can see on mobile version, the header is really really small.
Thanks a lot !
Pierre
Hi
The code should look like in this screen: http://screencast.com/t/NJtcqnrJ Just replace all code from header-menu.php file with this one: http://pastebin.com/19NaFmcg and replace the page id and image url as i indicated in the screen.
To increase the logo size on mobile devices use this css in theme panle > custom code > custom css: http://screencast.com/t/OMrlgBHyp1yv and modify the width value as you want:
@media (max-width: 767px){
.td-main-menu-logo img {
width: 70%;
}
}
Thanks!