Section header change
Support Area › Forums › United › Section header change
- This topic has 7 replies, 2 voices, and was last updated 9 years, 4 months ago by Bill Robbins.
-
AuthorPosts
-
December 11, 2014 at 14:08 #24834Shannon BlosserParticipant
I’m using a child theme and I would like to give a section of pages a different header instead of the normal logo and tagline. Where can I make that change?
December 11, 2014 at 15:06 #24837Bill RobbinsModeratorHello Shannon,
You can do that if you need to. You’ll need to copy the parent theme’s header.php file to the child theme and add a conditional statement to it. If you’ll let me know the names of the pages where you want to have a different logo/tagline, I’ll send you back the code for it.
Thanks,
BillDecember 11, 2014 at 15:34 #24839Shannon BlosserParticipantI figured I needed to copy the header.php file, just wasn’t sure where to go from there! 🙂 The pages are for our teen section:
http://66.147.244.60/~mrliborg/youth-spot/
http://66.147.244.60/~mrliborg/youth-spot/lol-leaders-library/
http://66.147.244.60/~mrliborg/youth-spot/teen-events/
http://66.147.244.60/~mrliborg/category/youth-blog/Let me know if you need additional information. Thanks for your help, I’m learning, but not quick enough. 🙂
December 11, 2014 at 16:02 #24841Bill RobbinsModeratorThanks Shannon. That works out great. Here’s what we’ll need to do:
- Go to the Media Section in your WordPress dashboard and select Add New. Upload the image you’d like to use for the secondary logo. Once the upload is complete, click on the edit link. Look on the right hand side of the screen that opens up for the File URL. We’ll need that in just a minute.
- Go to the Appearance section in your WordPress dashboard and choose Edit.
- From the list of files on your right, choose header.php and replace everything in the file with this:
(Be sure to copy the code from the support site and not the notification email. - To add in your logo, find this line in your new header file:
<h1><a href="<?php home_url(); ?>/"><img src="http://yoursite.com/image.png" alt="" /></a></h1>
and replace the
http://yoursite.com/image.png
with the URL to the image you just uploaded. - A couple of lines below that, change this text:
Second Tagline
to the tagline you’d like to have in this section.
- Save your changes.
If all works, that should give you a different logo in that section of your site. Let me know if you have any trouble.
Thanks,
BillDecember 11, 2014 at 17:12 #24842Shannon BlosserParticipantThat worked great for that subsection! My only problem is that now the normal logo and tagline don’t show up on the other pages.
December 11, 2014 at 17:37 #24843Bill RobbinsModeratorSorry about that. I simplified that section a bit and unintentionally took out the echo command for the original logo and tagline. I updated the code above. See if it won’t work for you now.
Bill
December 16, 2014 at 09:12 #24940Shannon BlosserParticipantThat fixed it! Thanks, Bill! Two more questions. When I click on a post with the category ‘youth-blog’ it goes back to the main header. Is it possible to make those posts have the teen header?
Second, if I would want to add a different header to a different set of pages do I just copy this section and change the pages:
<?php if ( is_page( array( ‘youth-spot’, ‘lol-leaders-library’, ‘teen-events’ ) ) || is_category( ‘youth-blog’ ) ) { ?>
<div id=”logo” class=”animated bounceIn”>
<h1>/”></h1>
</div><?php if ( of_get_option(‘tagline_include’) == ‘yes’ ) { ?>
<div id=”tagline” class=”animated bounceIn”><h2>Second Tagline</h2></div>
<?php } ?>
December 16, 2014 at 09:34 #24943Bill RobbinsModeratorGood Morning Shannon,
I believe you can change the header on the single posts too. Here’s the full header.php file that should make that possible as well:
Good thinking about how to add in another conditional. You’ll need to duplicate line 118 which looks like this:
<?php } else { ?>
and modify it so that it’s like this:
<?php } else if ( is_page( array( 'youth-spot', 'lol-leaders-library', 'teen-events' ) ) { ?>
Then add in your new header/tagline code before the original:
<?php } else { ?>
and the code that follows. That should let you add in another logo and tagline. WordPress has lots of conditional tags built in (http://codex.wordpress.org/Conditional_Tags) to help you create content that’s unique for the page that’s being viewed.
Let me know if you have any questions,
Bill -
AuthorPosts
- The topic ‘Section header change’ is closed to new replies.