- This topic has 11 replies, 4 voices, and was last updated 5 years, 6 months ago by
Leo.
-
AuthorPosts
-
September 18, 2014 at 12:51 pm #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!
September 18, 2014 at 1:44 pm #31585Tom
Lead DeveloperLead DeveloperI 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 π
September 18, 2014 at 1:45 pm #31586Pam
Thanks Tom! I’ll give it a try!
September 19, 2014 at 6:50 am #31804Pam
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!!
September 19, 2014 at 8:48 am #31839Tom
Lead DeveloperLead DeveloperAre you sure you added the code to the “Before Header Content” area? Sounds like you’re using the “After Header” area?
Let me know π
September 19, 2014 at 9:09 am #31851Pam
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!
September 19, 2014 at 9:24 am #31856Tom
Lead DeveloperLead DeveloperHmm, 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?
September 19, 2014 at 10:09 am #31859Pam
It’s a local site and hasn’t been uploaded yet. I’ll keep working with it and see what I can do. Thanks!
February 26, 2018 at 1:39 pm #506312Mike
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?
February 26, 2018 at 6:14 pm #506455Leo
StaffCustomer SupportHi 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 π
February 28, 2018 at 1:05 pm #508295Mike
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?
February 28, 2018 at 4:25 pm #508410Leo
StaffCustomer SupportIt should be compatible with the current version of WordPress.
Wouldn’t worry about the message π
-
AuthorPosts
- You must be logged in to reply to this topic.