WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] is_category question. (5 posts)

  1. theoriginaljordan
    Member
    Posted 10 months ago #

    Hello All,

    I am trying to make the logo in my header change
    if the category is set to a specific category.

    I have three different logos I need to cycle through.
    One appears if is_category('one')
    Two appears if is_category('two')
    The third I want to show up neither of these are true.

    I apologize for my ignorance. I am new to the php/wordpress world.

    Thanks in advance

  2. theoriginaljordan
    Member
    Posted 10 months ago #

    This will probably make it easier to help me out.

    <?php if ( is_category( 'athome' ) ) { ?>
    <img src = "http://images/logo1.png" />
    <?php } else ( is_category( 'whirlweddings' ) ) { ?>
    <img src = "http://images/logo2.png" />
    <?php } else () ) { ?>
    <img src = "http://images/logo3.png" />
    <?php } ?>
  3. Harrison O.
    Member
    Posted 10 months ago #

    Try this:

    <?php if ( is_category( 'athome' ) ) { ?>
    <img src = "http://images/logo1.png" />
    <?php }
    elseif ( is_category( 'whirlweddings' ) ) { ?>
    <img src = "http://images/logo2.png" />
    <?php }
    else { ?> <img src = "http://images/logo3.png" />
    <?php } ?>
  4. theoriginaljordan
    Member
    Posted 10 months ago #

    I actually just figured it out. It due to my if else statement.

    The proper order was
    if, elseif, else

  5. theoriginaljordan
    Member
    Posted 10 months ago #

    Thanks anyway Harrison, sorry to have wasted you're time.

Reply

You must log in to post.

About this Topic