- This topic has 8 replies, 2 voices, and was last updated 8 years, 2 months ago by
Tom.
-
AuthorPosts
-
April 13, 2015 at 9:14 pm #98376
Lowana
Hi,
I have just downloaded generate press and purchased the add-ons. I need to have different headers on different pages. I have managed to put a header on my pages, but on some pages I don’t want a header and other pages I want a different header. How do I do this? I have tried adding the link to the header on my page or inserting the image, but doesn’t seem to work. Also a couple of my pages when I click on edit to edit my page there is just a blank page. How do I change this?
Thanks,
Lowana.April 13, 2015 at 11:21 pm #98390Tom
Lead DeveloperLead DeveloperHi Lowana,
By header, do you mean where the site title/tagline go? Above the navigation?
If so, you can disable the header on certain pages using the Disable Elements add-on.
To display different headers on different pages, you’ll have to use GP Hooks.
For example:
<?php if ( is_page( 'about-page-slug' ) ) { ?> <img src="URL TO YOUR HEADER FOR THIS PAGE" alt="" /> <?php } elseif ( is_page( 'another-page-slug' ) ) { ?> <img src="URL TO YOUR HEADER FOR THIS PAGE" alt="" /> <?php } elseif ( is_page( 'one-more-example' ) ) { ?> <img src="URL TO YOUR HEADER FOR THIS PAGE" alt="" /> <?php } else { ?> <img src="URL TO YOUR HEADER FOR ALL OTHER PAGES" alt="" /> <?php } ?>
You would add the above into the “Before Header Content” hook in GP Hooks, and update the page slugs to match the pages you’re trying to target.
Then place the URL to your header image for each page.
The last one is the header for all other pages not mentioned above it.
Be sure to check the “Execute PHP” checkbox as well.
Let me know if you need more info π
April 14, 2015 at 5:54 pm #98590Lowana
Hi Tom, Thanks for your quick reply. I have managed to remove the header on some of my pages. I’m a bit confused about the GP hooks. I don’t really know much about different codes etc. I was hoping I could just add the header image or URL. I have put together 10 newsletters and want the same header image on each of these. The other header image will be for my website. Would you be able to give me some more information about this or have a look at my website to help me add these headers? I can send you the details privately if needed.
Thank-you.April 14, 2015 at 11:06 pm #98662Tom
Lead DeveloperLead DeveloperAre you wanting to replace your actual site header on these pages? If not, you can just use the Page Header add-on to include a secondary header on the newsletter pages. That would be your best bet.
Otherwise, you’ll have to use the code posted above, and replace the page slugs with the page slugs to your pages. If you’d like to post the URLs to the newsletter pages here, I’ll try to find some time to write something up for you π
April 15, 2015 at 12:16 am #98671Lowana
Hi Tom,
I will try to add the secondary header for now, and let you know if I have any other questions.
It’s good to know I can get the help that I need in this forum.
Thank-you,
Lowana.April 15, 2015 at 7:33 am #98724Tom
Lead DeveloperLead DeveloperSounds good – I’ll be here! π
July 6, 2015 at 11:22 am #119011Lukas
Hello Tom,
I have problem with changing the logo on different pages. As you can see I have already different background images on page “Blog” and “About me”. Now I want to make disappear the logo “Svatba Jany a Honzy” and change it to another one. I am completly beginner in using PHP so I do not understand to the code posted above. What should I type to the begin of the code instead of “about-page-slug”? Space after ALT is for what?
Sorry for my bad english, I am not native speaker.
Thank you for your time.
July 6, 2015 at 11:22 am #119012Lukas
The site is: http://www.jeaninna.cz , add it to my first post if you can.
July 6, 2015 at 12:23 pm #119021Tom
Lead DeveloperLead DeveloperHi Lukas,
This may help: http://generatepress.com/forums/topic/change-site-header-and-title-based-on-page/#post-111841
It allows you to set a default header, but also specify custom ones for specific pages/posts if you need to.
-
AuthorPosts
- You must be logged in to reply to this topic.