Section header change

Support Area Forums United Section header change

This topic contains 7 replies, has 2 voices, and was last updated by  Bill Robbins 2 years, 11 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
URL to the page in question: http://
  • Author
    Posts
  • #24834

    Shannon Blosser
    Participant

    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?

    #24837

    Bill Robbins
    Moderator

    Hello 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,
    Bill

    #24839

    Shannon Blosser
    Participant

    I 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. 🙂

    #24841

    Bill Robbins
    Moderator

    Thanks Shannon. That works out great. Here’s what we’ll need to do:

    1. 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.
    2. Go to the Appearance section in your WordPress dashboard and choose Edit.
    3. 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.

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

    5. A couple of lines below that, change this text:
      
      Second Tagline
      

      to the tagline you’d like to have in this section.

    6. 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,
    Bill

    #24842

    Shannon Blosser
    Participant

    That worked great for that subsection! My only problem is that now the normal logo and tagline don’t show up on the other pages.

    #24843

    Bill Robbins
    Moderator

    Sorry 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

    #24940

    Shannon Blosser
    Participant

    That 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 } ?>

    #24943

    Bill Robbins
    Moderator

    Good 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

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Section header change’ is closed to new replies.