• Hello,
    I am trying to use two different color headers on the site:
    https://bulldawgtraining.com/wordpress1/
    The Home page and default pages should have a red logo in the header. All pages related to Physical Therapy https://bulldawgtraining.com/wordpress1/physical-therapy/
    should have a blue logo. There will be about 5 pages with the blue logo – I can set them all in the “if(is_page) code as I did for the current blue page. However, then all the other pages have no logo … how do I set that at the end with php?

    I have set these two pages specifically in the header.php file as follows:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser. Or use pastebin.com instead. ]

    <body <?php body_class(); ?>>
    <div id="wrapper" class="hfeed">
    <div id="header">
    <?php
    if(is_page('Physical Therapy') ):
    	// Physical Therapy?>
    <img src="https://bulldawgtraining.com/wordpress1/wp-content/uploads/2012/10/Bull-Dog-Logo-Final-Lotus-BLUE.jpg" width="350px">
    
    <?php elseif(is_front_page() )://front_page ?>
    <img src="https://bulldawgtraining.com/wordpress1/wp-content/uploads/2012/07/bulldawg-logo.jpg" width="350px">
    
    <?php endif; // end the if, no images for other categories ?>
    
    <div class="logo-address">
    571-970-6068
    5001-A Lee Highway
    Suite 102
    Arlington, VA 22207
    
    <ul>
    <li><form role="search" method="get" id="searchform" action="https://bulldawgtraining.com/wordpress1/" >
    	<div><label class="screen-reader-text" for="s">Search for:</label>
    	<input type="text" value="" name="s" id="s" />
    	<input type="submit" id="searchsubmit" value="Search" />
    	</div>
    	</form></li>
    			</ul>
    </div><!-- #logo-address-->
    
    </div><!-- #header -->

    But want to be able to apply a default red logo to “else.” can someone please suggest how to do this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • But want to be able to apply a default red logo to “else.”

    if the problem is about the syntax of an ‘if/elseif/else’ structure, check:

    https://php.net/manual/en/control-structures.elseif.php

    Thread Starter tlcbytaragmailcom

    (@tlcbytaragmailcom)

    Thank you!

    Thread Starter tlcbytaragmailcom

    (@tlcbytaragmailcom)

    How would I write this code if I am not using echo. I am just inserting a different img? AND, is there are way to make the Physical Therapy page and all the pages that are child pages to “Physical Therapy” blue, and ALL THE REST of the pages red, rather than list all the child pages separately (ie “First Visit”)?

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser. Really, please use the code button. ]

    <div id="header">
    <?php if(is_page('Physical Therapy') ):
    	// Physical Therapy?>
    <img src="https://bulldawgtraining.com/wordpress1/wp-content/uploads/2012/10/Bull-Dog-Logo-Final-Lotus-BLUE.jpg" width="350px">
    
    <?php else if(is_page('First Visit') ):
    	// First Visit?>
    <img src="https://bulldawgtraining.com/wordpress1/wp-content/uploads/2012/10/Bull-Dog-Logo-Final-Lotus-BLUE.jpg" width="350px">
    
    <?php elseif(is_front_page() )://front_page ?>
    <img src="https://bulldawgtraining.com/wordpress1/wp-content/uploads/2012/07/bulldawg-logo.jpg" width="350px">

    Thanks.

    Thread Starter tlcbytaragmailcom

    (@tlcbytaragmailcom)

    Sorry – still having trouble with the image code. I currently have the image placed within the header div using html. I also have another div nested within the header, which contains the address, phone and a search bar. The url is https://bulldawgtraining.com/wordpress1/

    Should I get rid of the html and replace it with some php? If so, can you please tell me how to code the php for this?

    <div id="header">
    <?php if(is_page('Physical Therapy') ):
    	// Physical Therapy?>
    <img src="https://bulldawgtraining.com/wordpress1/wp-content/uploads/2012/10/Bull-Dog-Logo-Final-Lotus-BLUE.jpg" width="350px">
    <?php elseif(is_front_page() )://front_page ?>
    <img src="https://bulldawgtraining.com/wordpress1/wp-content/uploads/2012/07/bulldawg-logo.jpg" width="350px">
    <?php endif; // end the if, no images for other categories ?>
    
    <div class="logo-address">
    571-970-6068<br />
    5001-A Lee Highway<br />
    Suite 102<br />
    Arlington, VA 22207
    <ul>
    <li><form role="search" method="get" id="searchform" action="https://bulldawgtraining.com/wordpress1/" >
    	<div><label class="screen-reader-text" for="s">Search for:</label>
    	<input type="text" value="" name="s" id="s" />
    	<input type="submit" id="searchsubmit" value="Search" />
    	</div>
    	</form></li>			</ul>
    
    </div><!-- #logo-address-->
    
    </div><!-- #header -->
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Different Header on SOME static pages’ is closed to new replies.