Forums

A different header per category (I tried everything!) (6 posts)

  1. DokiDoki069
    Member
    Posted 2 years ago #

    Hi, I'd need some help, I tried to follow online tutorials on how to change my header for each category but it seems that my files are slightly different (custom template) and I end up getting lost (I'm a newbie for everything that concerns php etc)
    is anyone offering some wordpress service or could help me to figure out how to do it?
    Thank you

  2. Samuel B
    moderator
    Posted 2 years ago #

  3. Deckster0
    Member
    Posted 2 years ago #

    The most basic solution would be:

    <?php if(is_category(Specify category ID)) {?>
    //Do stuff here...
    <?php } else { ?>
    //Do stuff here if visitor isn't viewing category X
    <?php }?>
  4. donwash
    Member
    Posted 2 years ago #

    I just put that stuff in my archive.php. Unfortunately it does not work within the single.php. Are there any improvements i can make?

  5. PhilGarrett
    Member
    Posted 2 years ago #

    for a single post you need to use in_category instead of is_category

  6. donwash
    Member
    Posted 2 years ago #

    nice! works and thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic