Custom Archive Template for Multiple Categories

I want to create a custom archive template for two post categories.

One of my categories is events, and the other one is courses (I have more). I already have a custom template for events (category-event.php), but I want to create another one to list both events and courses, but not include any other categories. The layout will be more or less the same as the category-event.php template. How can I do this?

Answers 1

  • The simplest way I can think of would be to have the two categories you want to display together grouped under a parent category.

    Parent Category
    |----Child Category A
    |----Child Category B

    The file category-parent-category.php would by default show posts from both. The file category-child-category-a.php would only show from a. The file category-child-category-b.php would only show from b. The file category.php would show from all categories.

    Would that do what you want?

Related Questions