View Single Post
Old 10-12-2012, 02:04 AM   PM User | #1
truetech
New to the CF scene

 
Join Date: Nov 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
truetech is an unknown quantity at this point
Assigning different banner pics to each page in Wordpress

I have a Wordpress theme I'm modifying (Bouqet, in case you're interested), and I want to get it to show a different banner pic for the different pages. The theme seems to have two stylesheets, one editable in Wordpress theme editor, and a second that is specific to the color scheme I am using. Originally, the header code shown below did NOT have the "style" attribute with a background image. The image is supposed to be defined in the CSS sheet specific to the color scheme. I have modified the html to include an inline style attribute that I want to override the background image defined in the stylesheet. I am trying to use the post ID to determine what page the user is on, and I have named my banner files the number of the post ID. Here is the code in the header.php file that I'm working with:

[CODE]
<header id="branding" role="banner" class="clearfix" style="background-image: url(<?php echo $post->ID; ?>.png);">
...more code here...
</header>
[CODE]

The problem that I'm running into is that this only seems to work for one page (it happens to be my main page). All other pages show a blank banner as if it can't find the image. Am I mistaken in my coding or my approach?

Thanks,
Jeremy
truetech is offline   Reply With Quote