WordPress.org

Ready to get started?Download WordPress

Forums

Issues w/Different Header Images for Categories and Pages (4 posts)

  1. Velanche
    Member
    Posted 7 years ago #

    Hello:
    I've been making steady progress, or so I've thought. Based on jberglund's code, this is my current code that's placed in the header.php file:

    <style type="text/css" media="screen">
    /* Calls the style sheets for each category */
    <?php
    $post = $wp_query->post;
    if (is_home()) {
    include(TEMPLATEPATH . '/style.css');
    } elseif ( in_category('1') ) {
    include(TEMPLATEPATH . '/cat-news.css');
    } elseif ( in_category('2') ) {
    include(TEMPLATEPATH . '/cat-reviews.css');
    } elseif ( in_category('8') ) {
    include(TEMPLATEPATH . '/cat-charts.css');
    } elseif ( in_category('9') ) {
    include(TEMPLATEPATH . '/cat-playlists.css');
    } elseif ( in_category('12') ) {
    include(TEMPLATEPATH . '/cat-podcasts.css');
    } elseif ( in_page('2') ) {
    include(TEMPLATEPATH . '/page-test.css');
    } elseif ( in_page('4') ) {
    include(TEMPLATEPATH . '/page-test.css');
    } else {
    include(TEMPLATEPATH . '/style.css');
    }
    ?>
    </style>

    <?php /* Calls the header image for each category - necessary code */
    $post = $wp_query->post;
    if (is_home()) {
    $imgurl = "images/ul-banner.png";
    } elseif ( in_category('1') ) {
    $imgurl = "images/ul-cat-news.png";
    } elseif ( in_category('2') ) {
    $imgurl = "images/ul-cat-reviews.png";
    } elseif ( in_category('8') ) {
    $imgurl = "images/ul-cat-charts.png";
    } elseif ( in_category('9') ) {
    $imgurl = "images/ul-cat-playlists.png";
    } elseif ( in_category('12') ) {
    $imgurl = "images/ul-cat-podcasts.png";
    } elseif ( in_page('2') ) {
    $imgurl = "images/ul-page-test.png";
    } elseif ( in_page('4') ) {
    $imgurl = "images/ul-page-test.png";
    } else {
    $imgurl = "images/ul-banner.png";
    }
    ?>
    <style type="text/css" media="screen">
    /* Disable the header style in the individual style sheets and embed it here. */
    #header {
    background: url(<?php bloginfo('stylesheet_directory') ?>/<?php echo $imgurl; ?>);
    height: 145px;
    background-color: #FFFFF0;
    </style>

    Now I've just entered the "in_pages conditions after verifying that the code works for categories. Unfortunately, they don't seem to work for the two page test conditions in the code.

    Also, I'm having varied issues per browser. It was something I've planned to deal with last before I publicize the new site live, but the results are pretty mixed. I should say, first of all, that I'm using Mac OS X.

    - Firefox 1.5.4: Again, the test conditions I've included in the code for the "The Radioshow" and "About Velanche" pages failed.

    - Safari: the home image appears, albeit without the white image background that's part of the CSS code. Otherwise, the other header images will not appear whether I click on the page or category links.

    - Netscape 7.2: the home header image appears, but the rest of the page does not show. It's just as bad without the header code, because it would show the header image and the white content background...but nothing else. Not the sidebar, not the footer....nothing else.

    - IE 5.2: well, not too worried about it because it's nearly a dead browser, but doesn't work very well there either. Don't remember the problems, but I'd rather I make sure it works on the Windows side that's still supported (for 5.x and 7.x beta).

    Looking forward to any assistance that can be offered. Thanks.
    Velanche

  2. moshu
    Member
    Posted 7 years ago #

    There is no conditional "in_pages"
    Where did you find it?
    See http://codex.wordpress.org/Conditional_Tags

  3. Velanche
    Member
    Posted 7 years ago #

    Thanks for the reference, moshu. Found that there's no in_page conditional. Tried "is_page" conditional" but there's no change.

  4. Tdude
    Member
    Posted 7 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic