Cyber Week Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Resolved] Header Image

Home Forums Support Header Image

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #31559
    Pam

    Is it possible to have a different image on each page in the top header section, that will be positioned directly above the navigation bar? I’d like for the image to sit at the very top of the page and not just above the content area. I used the Customizer Background Images add-on Header section and that worked great but now the client has decided they want a different image on each page. Thanks for your help!

    #31585
    Tom
    Lead Developer
    Lead Developer

    I would use GP Hooks to achieve this.

    In the “Before Header Content” area, you would use PHP if conditions.

    For example:

    <?php if ( is_page( 'page-a-slug' ) ) : ?>
          <img src="THE URL TO YOUR IMAGE" alt="" />
    <?php endif; ?>
    
    <?php if ( is_page( 'page-b-slug' ) ) : ?>
          <img src="THE URL TO YOUR IMAGE" alt="" />
    <?php endif; ?>
    
    <?php if ( is_page( 'page-c-slug' ) ) : ?>
          <img src="THE URL TO YOUR IMAGE" alt="" />
    <?php endif; ?>

    You would replace the ‘page-a-slug’ etc with the slug for those specific pages. The slug being the part of the URL after your .com. For example, the slug to this page would be ‘header-image’.

    Last, you’ll need to check the “Execute PHP” checkbox.

    Hope this helps 🙂

    #31586
    Pam

    Thanks Tom! I’ll give it a try!

    #31804
    Pam

    Hey Tom, I now have different images showing up on the individual pages. The images are positioned between the navigation bar and the content area with white space above the navigation bar. I would like the images to be located in the white area above the navigation bar instead of being positioned above the content area. Is this possible? Thanks so much for your help!!

    #31839
    Tom
    Lead Developer
    Lead Developer

    Are you sure you added the code to the “Before Header Content” area? Sounds like you’re using the “After Header” area?

    Let me know 🙂

    #31851
    Pam

    I’ve tried the code in both the “before header content” and “before header” sections but it keeps showing up over the content area. Thanks again for your help!

    #31856
    Tom
    Lead Developer
    Lead Developer

    Hmm, definitely shouldn’t be – that’s not how hooks work.

    Can you email me with your URL, username and password so I can take a quick peak?

    support@generatepress.com

    #31859
    Pam

    It’s a local site and hasn’t been uploaded yet. I’ll keep working with it and see what I can do. Thanks!

    #506312
    Mike

    Sorry to bump an old request, but this is exactly the thing I’m trying to do. The image in question is defined as a background image and this occurs in the <head> section. The suggestion above seems to be defining alternative foreground images.

    Undeterred I tried adding a style section using the wp_head hook. I can happily add basic CSS, but the minute I try to add a rule containing background-image the save fails with a 403 error telling me I don’t have permission to access /cms/wp-admin/options.php. I tried changing the file permissions to 777 temporarily but I still get the same error.

    Does anyone have any ideas?

    #506455
    Leo
    Staff
    Customer Support

    Hi there,

    I’m not quite sure what you are trying to achieve.

    Can you open a new topic and link me to your site?

    There might be better ways to achieve what you want then 2014 🙂

    #508295
    Mike

    Hi Leo,

    Thanks for the reply. I won’t raise a new thread because you were right, there are better ways. I just hadn’t found the answer when I posted. Simply CSS is my friend and works perfectly.

    One small final request: can Simply CSS be updated to say it works with the current WP?

    #508410
    Leo
    Staff
    Customer Support

    It should be compatible with the current version of WordPress.

    Wouldn’t worry about the message 🙂

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