Forums

Different images in headers by category (2 posts)

  1. stmcgill
    Member
    Posted 3 years ago #

    Quick question.

    I am using a theme here (www.totaliphone.com) and want to be able to change the advert image in the header for each category that is displayed.

    At the moment the text for the image in the header.php file is-

    <div class="right">
    <img src="http://www.pda-247.com/brandocomhk2.gif" alt="" width="538px" height="50px" />

    </div>

    Is there some code I can add to make it change the image automatically for each category?

  2. motivatebusiness
    Member
    Posted 3 years ago #

    You could try using conditional statements, and assign a unique header image in your stylesheet. Please see the example below:

    Example:

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

    View the codex here: http://codex.wordpress.org/Conditional_Tags#A_Category_Page

    If you need personalized help. I am available, you can contact me personally by useing one of the messengers below:
    [signature moderated Please read the Forum Rules]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.