Can you please mention the URL of your website so we can actually check what is going on?
Hi,
I've uploaded several new images for the header, but only 2 of them appear.
Now, when I try to change these to new ones, the new ones don't appear.
I've uploaded the images to the image folder and given them names: header1, 2, etc and renamed the old ones.
What am I doing wrong?
hope someone can help....
Can you please mention the URL of your website so we can actually check what is going on?
yes, sorry: www.safranfilm.dk
There are 5 default images in the Cutline images folder. If you want them replaced you need to upload your images and their names must be exactly the same as the ones you're replacing, i.e. header_1.jpg all the way to header_5.jpg.
Now, I'm not sure what you mean by not displaying because I tried loading header_2 and the file is missing so please fix your filenames first. The other images still look the defaults.
Next, the headers 1-5 appear on different sections of the website, as dictated in header.php. Here is the code:
This basically says:PHP Code:<div id="header_img">
<?php if (is_home()) { ?>
<img src="<?php bloginfo('template_url'); ?>/images/header_1.jpg" width="770" height="140px" alt="<?php bloginfo('name'); ?> header image 1" title="<?php bloginfo('name'); ?> header image 1" />
<?php } elseif (is_single()) { ?>
<img src="<?php bloginfo('template_url'); ?>/images/header_2.jpg" width="770" height="140px" alt="<?php bloginfo('name'); ?> header image 2" title="<?php bloginfo('name'); ?> header image 2" />
<?php } elseif (is_page()) { ?>
<img src="<?php bloginfo('template_url'); ?>/images/header_3.jpg" width="770" height="140px" alt="<?php bloginfo('name'); ?> header image 3" title="<?php bloginfo('name'); ?> header image 3" />
<?php } elseif (is_archive()) { ?>
<img src="<?php bloginfo('template_url'); ?>/images/header_4.jpg" width="770" height="140px" alt="<?php bloginfo('name'); ?> header image 4" title="<?php bloginfo('name'); ?> header image 4" />
<?php } else { ?>
<img src="<?php bloginfo('template_url'); ?>/images/header_5.jpg" width="770" height="140px" alt="<?php bloginfo('name'); ?> header image 5" title="<?php bloginfo('name'); ?> header image 5" />
<?php } ?>
</div>
Homepage: header_1
Single posts: header_2
Static pages: header_3
Archive pages (tag, category, etc.): header_4
Everything else: header_5
You can change the conditions for your headers but you'll need further knowledge on conditional tags and PHP.
thanks! I understand that I don't have to change anything in the actual PHP codes.
It seems to work now - except that I thought the images would change when clicking on the different menus, but according to your explanation, these Static pages will display the same image?
Yup, every static page will display the same image. If you want different headers for different pages, use is_page('Title of Page')
Thank you for this tutorial. I already made changes with my header but instead of per page, I choose to have different header per category. But as you said it only applies to archive pages. Obviously I do not know much about PHP conditional tags. My question is if it's possible to apply the assigned header on the single post page based on it's category? Since the images were assigned to the categories, I was hoping that the header would also appear on posts under those assigned categories.This basically says:
Homepage: header_1
Single posts: header_2
Static pages: header_3
Archive pages (tag, category, etc.): header_4
Everything else: header_5
You can change the conditions for your headers but you'll need further knowledge on conditional tags and PHP.
You can use this:
After the last <?php } ?>PHP Code:<?php if ( is_category('CATEGORYNAME') ) { ?>
<img src="<?php bloginfo('template_url'); ?>/images/IMAGEFILENAME.jpg" width="770" height="140px" alt="<?php bloginfo('name'); ?> header image 5" title="<?php bloginfo('name'); ?> header image 5" />
<?php } ?>
Where CATEGORYNAME = name of category and IMAGEFILENAME.jpg = filename of header image.
Bookmarks