+ Reply to Thread
Results 1 to 8 of 8

Thread: How to change Heade img

  1. #1
    Join Date
    Nov 2010
    Posts
    3

    Default How to change Heade img

    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....

  2. #2
    Join Date
    Feb 2009
    Posts
    605

    Default

    Can you please mention the URL of your website so we can actually check what is going on?

  3. #3
    Join Date
    Nov 2010
    Posts
    3

    Default

    yes, sorry: www.safranfilm.dk

  4. #4
    Join Date
    Feb 2009
    Posts
    605

    Default

    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:

    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>
    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.

  5. #5
    Join Date
    Nov 2010
    Posts
    3

    Default

    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?

  6. #6
    Join Date
    Feb 2009
    Posts
    605

    Default

    Yup, every static page will display the same image. If you want different headers for different pages, use is_page('Title of Page')

  7. #7

    Default

    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.
    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.

  8. #8
    Join Date
    Feb 2009
    Posts
    605

    Default

    You can use this:

    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 ?>
    After the last <?php } ?>

    Where CATEGORYNAME = name of category and IMAGEFILENAME.jpg = filename of header image.

+ Reply to Thread

Similar Threads

  1. How To Change Size Of Top Nav Bar Links?
    By magentawave in forum Header & Nav Bar
    Replies: 1
    Last Post: 10-31-2010, 02:35 PM
  2. Change image header
    By alexcalle in forum Header & Nav Bar
    Replies: 1
    Last Post: 02-23-2010, 03:22 PM
  3. Frontpage name change
    By GeerinckGwen in forum Posts, Pages, Comments
    Replies: 5
    Last Post: 11-09-2009, 07:50 PM
  4. Change my username?
    By candyaddict in forum Random Chat
    Replies: 3
    Last Post: 01-31-2009, 06:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts