Changing headers or deleting headers

Home Forums Support Changing headers or deleting headers

Home Forums Support Changing headers or deleting headers

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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.

    #98390
    Tom
    Lead Developer
    Lead Developer

    Hi 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 πŸ™‚

    #98590
    Lowana

    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.

    #98662
    Tom
    Lead Developer
    Lead Developer

    Are 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 πŸ™‚

    #98671
    Lowana

    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.

    #98724
    Tom
    Lead Developer
    Lead Developer

    Sounds good – I’ll be here! πŸ™‚

    #119011
    Lukas

    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.

    #119012
    Lukas

    The site is: http://www.jeaninna.cz , add it to my first post if you can.

    #119021
    Tom
    Lead Developer
    Lead Developer

    Hi 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.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.