WordPress.org

Ready to get started?Download WordPress

Forums

1 post / 2 categories / different Archive page required (1 post)

  1. juxprose2
    Member
    Posted 5 years ago #

    In this example I make a post and categorize as EXHIBITION, and SHOP.

    I have two category pages - category-1.php for EXHIBITION and category-2.php for SHOP. Both these pages display the same post content, but with a different page layout.

    That's all fine.

    I also have sub categories for each of the two categories, so I make a menu to list the sub cats on each category page, for example for category 1:

    <?php wp_list_categories('orderby=id&use_desc_for_title=0&child_of=1&title_li='); ?>

    This now brings up links to the archive.php page for each sub category, where I also need two different layouts for each category archive. So, I create a conditional for:

    <?php if (in_category('1')) { ?>
    >Display category 1 divs etc to output the category 1 layout.

    <?php elseif (in_category('2')) { ?>
    >Display divs etc for category 2 layout

    But...

    When a post is in two categories (in this case 1 and 2), the archive page doesn't know which conditional result to display, so I get my category 2 archive displayed in the layout for category 1.

    Any ideas as to how to achieve 2 layouts for the Archive.php page? Or any other suggestions for this?

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic