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)
-   -   Specific image rotation on page? (http://forum.bytesforall.com/showthread.php?t=2203)

blueprairie Jun 27, 2009 08:16 PM

Specific image rotation on page?
 
Is it posssible to set up the header image so that is loads from a different directory of header images (still random) but specific to the active page? so images/headerhome would be one set of images and images/headerpageone would be a different set of images?

juggledad Jun 28, 2009 08:18 PM

You could muck with header.php and copy the existing code and add a is_page(..) to identify the page you want the new code on and the directory to grab the images from

zagato Jul 23, 2009 03:05 AM

This is nearly a month old, but because I wanted to have this solved for a website of myself and juggledad showed the right direction, I thought I'll just post what I did to make that work:

Edit "bfa_rotating_header_images.php" from Atahualpa's "functions" folder.
Look for this code:
PHP Code:

$imgpath TEMPLATEPATH '/images/header/';
$imgdir get_bloginfo('template_directory') . '/images/header/'

Change it to something like this:
PHP Code:

if (is_page('11')) {
      
$imgpath TEMPLATEPATH '/images/header/special/';
          
$imgdir get_bloginfo('template_directory') . '/images/header/special/';
    } else {
      
$imgpath TEMPLATEPATH '/images/header/';
          
$imgdir get_bloginfo('template_directory') . '/images/header/';


This will show all the header images from the subfolder "special" (which I created in the "/images/header/" folder of the theme) on the page with ID 11.
To find out the IDs of pages, I use the WP-Plugin "Reveal IDs for WP Admin", which is handy.

Hope that helps.

P.S.: If there is a better way which will preserve the extra code after updates, I'd be happy to hear.

Friland Aug 8, 2009 03:12 PM

Thank you Zagato!
It works.
Now, I only use my website as a 'traditional' website and not a blog.
I would like to have a different headerimage on each page.
I thought I could use your idea but then only have one image in the folder you call 'special'.
Then I would obviously have to create many folders within the 'header' folder.
I tried to copy paste your code and create a new code for each 'special' folder. Something like this:

if (is_page('11')) {
$imgpath = TEMPLATEPATH . '/images/header/special1/';
$imgdir = get_bloginfo('template_directory') . '/images/header/special1/';
if (is_page('12')) {
$imgpath = TEMPLATEPATH . '/images/header/special2/';
$imgdir = get_bloginfo('template_directory') . '/images/header/special2/';
if (is_page('13')) {
$imgpath = TEMPLATEPATH . '/images/header/specia3/';
$imgdir = get_bloginfo('template_directory') . '/images/header/special3/';

} else {
$imgpath = TEMPLATEPATH . '/images/header/';
$imgdir = get_bloginfo('template_directory') . '/images/header/';
}

But it certainly doesn't work! (And I know that I am very new to this stuff!)

Do you have an idea of how I can solve my problem with having different header image for each page and sub-page I create?

Thank you a bunch on beforehand,
Lukas
www.friland.org/wordpress (a page in progress. just mock-up for now)


All times are GMT -6. The time now is 02:26 PM.

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