Jump to content
Sign in to follow this  
deadlytim

Random header on most pages BUT not ALL

Recommended Posts

deadlytim    0
deadlytim

Hello there oh wise forum. Please bring me help... I'm looking to make my blog have random headers on most but not all pages. For example on the page: http://harringtonandselves.com/unpleasantries/ I want the image <a href=http://harringtonandselves.com/img/headers/header-unpleasantries.jpg' alt='' class='ipsImage' > On general pages I want to pull randomly from the http://harringtonandselves.com/img/headers/ directory- yes they are all the same size. From my searching it seems like this is a job from the custom section of Pagelines but I haven't been able to get it to work. I'm not sure how to target CSS type changes to a specific page. Is it .unpleasantries or something? Or a page ID? Is the random image thing a totally unrelated issue to the "hard coded" headers for specific pages? How do they play together? I'll be adding more pages with specific headers as well as more random headers soon so the solution needs to be extensible. Thanks for any help! FWIW I sacrificed a goat to the Forum God in hopes of a speedy and clear response. I dropped the goat into my USB port like it was a volcano. ;-)

Share this post


Link to post
Share on other sites
Rob    547
Rob
Wow, this is a challenge that requires some divine inspiration! One strange thought that comes to mind would be to replace the branding image with an ad injection using a combination of plugins plus OpenX, an ad management script. Check this plugin: http://wordpress.org/extend/plugins/ad-injection/ OpenX installs totally separate from WordPress, but the plugin coordinates with it, bringing the appropriate code into WordPress, and thus into your header. You would treat each individual header as an ad that will be placed only on certain pages or posts. The code needed would be provided by the plugin. As a result, you simply schedule the different ads to appear on different pages according to your wishes. There are also other ad management plugins available at http://www.wordpress/extend/plugins and you're free to search for something you think might be easier. In any case, the essential changes need to be made in functions.php and/or the applicable template, depending on the method you need. Some CSS might also be needed to position the ad/image where you want it.

Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
deadlytim    0
deadlytim
hmmm... I was able finally to get different header images to work- Used a clear gif as the header image in global options and added this to the custom CSS #branding .branding_wrap{ background: url('http://harringtonandselves.com/img/headers/header-time.jpg') no-repeat 0 0 transparent; height:84px; } body.page-id-139 #branding .branding_wrap{ background: url('http://harringtonandselves.com/img/headers/header-unpleasantries.jpg') no-repeat 0 0 transparent; height:84px; } For the random could I replace: #branding .branding_wrap{ background: url('http://harringtonandselves.com/img/headers/header-time.jpg') no-repeat 0 0 transparent; height:84px; } with a php script that returns a random value for url()? I know how to do this kind of thing if you could tell me where in which file to start messing with. Something in the themes css directory?

Share this post


Link to post
Share on other sites
deadlytim    0
deadlytim
What I want to do is have different versions of my header graphic load randomly each time. I was thinking I could code something to randomize the value of background: url #branding .branding_wrap{ background: url('http://harringtonandselves.com/img/headers/header-time.jpg') no-repeat 0 0 transparent; height:84px; }

Share this post


Link to post
Share on other sites
kastelic    6
kastelic
Here's a php script that will do this: Paste into platformbase/functions.php. [code] //RANDOM HEADER BG add_action('wp_head','random_url'); function random_url(){ $url_list = array( 'http://harringtonandselves.com/img/headers/header-time.jpg', 'http://harringtonandselves.com/img/headers/header-unpleasantries.jpg' ); shuffle($url_list); ?>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×