Support » Themes and Templates » Page condition grouped on category

  • Resolved bluedot


    I am a wordpress convert. I love it’s simplicity compared to the Postnuke I used to develop with. Currently, I am moving 10 years of static content to a new WordPress site.

    I would like to place a conditional statement in my header.php file as such:
    <?php if ( is_category(stories) ) { include ('header-stories.php'); } ?>

    But this only works when a category is called in the URL. I would like every post that is within this category to show the alternate header. All story posts, no matter how they are called, by category or by single.php should bear the story header.

    I have too many stories to post as ‘posts’ to do if_post(array()) conditions, as there are hundreds. I need to group them by category.

    This must be possible… right?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bluedot


    I found my answer. The key was to implement the category.php and tag.php templates. I then add a simple loop looking for tags, pages or categories based on being in the respective templates.

    We now have dynamic headers based on pages, categories, single posts and tags! Woohoo!

    hi bluedot,
    could you please explain this in detail, as a newbie can understand?
    thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Page condition grouped on category’ is closed to new replies.