WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] help, please: custom header image for each category (2 posts)

  1. Razz
    Member
    Posted 6 years ago #

    Simply put, I want to be able to have a custom header image for each category. When the user visits the main page, there's the "Welcome to whatever" header image. And when they click on the "Travels" category, lets say, the page listing the all the postings under the "Travels" category has the "Travels" image at the top of the page.

    I swear I'm going to throw my keyboard through my monitor when I find out how easy this really turns out to be...

  2. Razz
    Member
    Posted 6 years ago #

    i hate myself. i solved my problem. basically, you need to put the is_category() function in an if statement (which i knew) but the issue was the parameters for the is_category() function. upon finding the Conditional tags page, i figured out the problem.

    Here is my code in case anyone ever needs to know this.

    <?
    if (is_home()){
    <img src="welcome.jpg">
    }
    
    if(is_category('Travels')){
    echo '<img src="travels.jpg">';
    }
    if(is_category('Musings')){
    echo '<img src="musings.jpg">';
    }
    if(is_category('Lunch')){
    echo '<img src="lunch.jpg">';
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic