Community Forums › Forums › Archived Forums › General Discussion › theme: beautiful, use header image on home page only?
- This topic has 12 replies, 2 voices, and was last updated 9 years, 10 months ago by Brad Dalton.
-
AuthorPosts
-
May 12, 2014 at 3:35 pm #104750bionaryMember
Does anyone know how to remove Beautiful's header image for all pages except the home page. It consumes an awful amount of space.
May 12, 2014 at 7:05 pm #104795Brad DaltonParticipantWhat you can do is add the conditional tag
is_front_page()
after the function.
May 12, 2014 at 9:43 pm #104843bionaryMemberExcuse my ignorance but:
1. what file would I add this conditional tag?
2. after what function?
3. would it look something like: ?
if(is_front_page()){ ...not sure what to look for }
May 12, 2014 at 10:02 pm #104844Brad DaltonParticipantYou'll need to find the function in your child themes functions.php file. Try Line 100
Yes, the code looks good but try this after the function name:
if ( is_front_page())
May 13, 2014 at 5:11 pm #104991bionaryMemberahh, I see now... I was looking for "image" not "banner" - skipped over that one. Your line 100 hit the nail on the head.
Thank you so much.
For anyone else looking to do this://* Hook site header banner after header add_action( 'genesis_after_header', 'beautiful_site_header_banner' ); function beautiful_site_header_banner() { if( is_front_page() ){ if ( ! get_background_image() ) return; echo '<div class="site-header-banner"></div>'; } }
May 13, 2014 at 6:55 pm #105010Brad DaltonParticipantHow about the gap? Did you modify the CSS to fix that?
May 13, 2014 at 7:11 pm #105017bionaryMember@braddalton.
The gap?, It did seem like there was a little room there, I thought that was just the template, because my conditional does remove the image and collapses somewhat, but you're right, it's probably unnecessarily large.I'm not sure what is the protocol for doing these sorts of things. So as not to loose my additions with future theme updates, I tried making a child class of theme:beautiful but it failed. (i read there was a limit for child classes?) I attempted this so that i could add custom css.
Not sure how i would target the spacing issue per page though. css i presume?
It's funny, I have over a decade's experience with fe/be web dev but I'm a complete noob with wordpress. I know I could hack anything to get it to do what I want, but I'm trying really hard to be patient and follow best practices:)
What do you suggest for the gap?May 13, 2014 at 7:55 pm #105021Brad DaltonParticipantI suggest you modify the CSS to remove the gap on all pages excluding your front page.
There are no child theme updates so you don't need top worry about losing custom coding.
May 15, 2014 at 3:42 pm #105376bionaryMember@braddalton
Normally I add an id to body or page wrapper but now that I'm working around wordpress what is the best practice for targeting a page for specific CSS?Looking at source code I can see wp adds a class to the body for each page and it appears to be it's database Id...so I could do something like:
body.page-id-180{ /* my customized css for just this page*/ }
This will work but then If I swap out the home page for a new one this will break.
What do you recommend?
Thanks.
May 15, 2014 at 8:18 pm #105401Brad DaltonParticipantMay 15, 2014 at 8:41 pm #105407bionaryMemberI must have been drinking. duh.. thanks again.
May 15, 2014 at 8:45 pm #105409bionaryMemberactually I take that back.... not sure why but some of my pages have the page name as a class attached to body tag and others simply have page-id-##.
i can't make sense of it.
May 16, 2014 at 12:08 am #105434Brad DaltonParticipant -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.