Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Header configuration & styling (http://forum.bytesforall.com/forumdisplay.php?f=15)
-   -   Header Images - One fixed image for Home Page - Rotate all images on all other pages? (http://forum.bytesforall.com/showthread.php?t=9650)

ClearlyRobert Sep 14, 2010 09:53 AM

Header Images - One fixed image for Home Page - Rotate all images on all other pages?
 
Header Images - One fixed image for Home Page - Rotate all images on all other pages?

Is there a way to do this?

TIA

lmilesw Sep 14, 2010 10:48 AM

You would have to set up a conditional to display an image on the home page and %image on all the others. Something like the following.
HTML Code:

<?php if( is_home() ) { ?>
<img src="http://path-to-image.jpg" />
<?php } else { ?>
%image
<?php } ?>


ClearlyRobert Sep 15, 2010 08:44 AM

Thanks for the response....

Is this the same approach if I wanted to use a specific image as a header for each of my 8-10 pages? Also, where do I use this code? On one of the theme set up pages?

Apologies for the newbie questions.

Robert

lmilesw Sep 15, 2010 11:21 AM

Yes... The code would be
HTML Code:

<?php if( is_page('33') ) { ?>
<img src="http://path-to-image1.jpg" />
<?php elseif ( is_page('4') ) { ?>
<img src="http://www.cnybiz.com/wp-content/themes/atahualpa353/images/backgr.gif" />
<?php elseif( is_page('34') ) { ?>
<img src="http://path-to-image2.jpg" />
<?php } else { ?>
%image
<?php } ?>

where 33 is the ID of the page.

Tyran Oct 11, 2010 04:02 PM

Where would this code be used exactly?

juggledad Oct 11, 2010 04:54 PM

it would go in ATO->Style & edit HEADER AREA->Configure Header Area

Tyran Oct 12, 2010 08:44 AM

I tried that and ended up with no header at all. I'll give it another try and see if I can figure out why.

juggledad Oct 12, 2010 09:34 AM

Tyran - you probably have a coding error. post the code you used

Tyran Oct 12, 2010 10:28 AM

lmilesw's code above actually contains the error. Corrected example code below:

Quote:

<?php if( is_page('33') ) { ?>
<img src="http://path-to-image1.jpg" />
<?php } elseif ( is_page('4') ) { ?>
<img src="http://www.cnybiz.com/wp-content/themes/atahualpa353/images/backgr.gif" />
<?php } elseif( is_page('34') ) { ?>
<img src="http://path-to-image2.jpg" />
<?php } else { ?>
%image
<?php } ?>

Tyran Oct 12, 2010 10:50 AM

The main problem with the original code is that it does not properly (as in it doesn't do it at all) insert the blog name or tag line. The code below inserts the image into the block created by %image:

HTML Code:

<?php if( is_page('29') ) {
        $HeaderURL="http://www.shantayoga.com/wp-content/themes/shanta/images/header/header.jpg";
        $CustomHeaderImage = 1;
} elseif ( is_page('22') ) {
        $HeaderURL="http://www.shantayoga.com/wp-content/themes/shanta/images/header/header-nidra.jpg";
        $CustomHeaderImage = 1;
} else {
        $CustomHeaderImage = 0;
} ?>



<?php if( $CustomHeaderImage == 1 ) { ?>
<div id="imagecontainer" class="header-image-container" style="background: url('<?php echo $HeaderURL; ?>') top center no-repeat;">
<div class="clickable"><a class="divclick" title="Shanta Yoga" href ="http://www.shantayoga.com/">&nbsp;</a></div>
<div class="titleoverlay"><h2 class="blogtitle"><a href="http://www.shantayoga.com/">Shanta Yoga</a></h2>
<p class="tagline">Live with Ease</p></div></div>
<?php } else { ?>
%image
<?php } ?>


lmilesw Oct 12, 2010 12:12 PM

Sorry about the missing }. The code I mentioned was only intended for the images. Where did you want your blog title and tag line to be displayed?


All times are GMT -6. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.