Forums

Different header image (not random) for each category? (8 posts)

  1. dotman
    Member
    Posted 1 year ago #

    I would like to have a specific header image for each category. I've searched the plugins and came up empty. anyone know of one or how to change the code to accomplish this? Thanks.

  2. jeremyclark13
    Moderator
    Posted 1 year ago #

  3. dotman
    Member
    Posted 1 year ago #

    Thank you jeremy. Could you give me an example of the modified code for say two categories? I'm assuming this would be going in the header template. Thanks again.

  4. jeremyclark13
    Moderator
    Posted 1 year ago #

    <?php if ( is_category(5) ) { ;?>
    <div id="headercat5">
    <?php } elseif ( is_category(6) ){ ;?>
    <dif id="headercat6">
    <?php } else { ;?>
    <div id="defaultheader">
    <?php } ;?>
    other stuff
    </div>

    Then just add the new ids to your style.css with the new background image.

  5. dotman
    Member
    Posted 1 year ago #

    Great, thank you, I'll see if I can make it work. Are these tags also available for pages as well? Thanks again.

  6. jeremyclark13
    Moderator
    Posted 1 year ago #

    Yes on that same link just scroll up a little for the page conditional tags.

  7. ontargetpro
    Member
    Posted 5 months ago #

    I found this post when looking for how to insert an image on the page (not changing the header), depending on the category. I ended up reading about conditions and came up with this:

    <?php if ( is_category(Baseball) ) { ;?>
    <?
    echo '<img src="baseball image location here" width="100" height="100">';
    ?>
    <?php } elseif ( is_category(Football) ){ ;?>
    <?
    echo '<img src="football image location here" width="100" height="100">';
    ?>
    <?php } elseif ( is_category(dance_team) ){ ;?>
    <?
    echo '<img src="/dance teamimage location here" width="100" height="100" align="left">';
    ?>
    <?php } else { ;?>

    <?php } ;?>

    The only trouble I had was one category named "Dance Team". It didn't like the space, so I used the category slug "dance_team" instead.

    Maybe this will help someone else.

  8. omnijh
    Member
    Posted 3 months ago #

    hi

    I'm trying to figure out how to have a simple header with just an image per category contained in it.. i thought i found the answer here.. but it doesnt seem to work

    http://www.femalepleasure.org/multitest/betabang/?cat=5

    i obviously also implemented the div(s) in my css but it wouldnt show

    I don't see what i did wrong.. can someone help please?
    it would be such a relief !
    thanks !

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.