Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
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
Old 10-12-2012, 02:25 AM   PM User | #2
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
Unhappy

Was just doing a little more testing, and realized that maybe the problem is that I am not properly specifying where the files are located. The inline style just has an image url of postID.png, which would suggest it finds the file in whatever folder the page is currently being loaded from. Now I am trying to code the inline style to spell out the path, but I can't seem to find the right syntax. I've tried:

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

and this:

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

and this:

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

As you can see, i'm workiing with a local WAMP server right now, but I'll be doing it again on a hosted site. The main page loads at localhost/nhpn.

Am I on the wrong track? I've spent upwards of 3 hours on this now, and it's reallly getting annoying!
truetech is offline   Reply With Quote
Old 10-19-2012, 09:51 PM   PM User | #3
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
Is no one able to answer this?
truetech is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:43 PM.


Advertisement
Log in to turn off these ads.