[resolved] Category and sub-category templates (3 posts)

  1. hinch
    Posted 8 years ago #

    I want my main category and sub categories to be displayed differently. Ideally I'd like to edit archive.php with a simple conditional statement. My link structure is like this:


    So I've been trying to make a conditional statement like this:

    if (isset(*sub-category*)) {
    else {

    I have been trying to get values get_query_var but no luck yet.

    Is this possible?

  2. stvwlf
    Posted 8 years ago #


    if ( is_category(' *subcategory ' ) ) {

    } elseif ( is_category(' *subcategory ' ) ) {

    } else {


    *subcategory* can be either the category number, the category slug, or the category name

    there is also in_category () which is useful in some cases

  3. hinch
    Posted 8 years ago #

    Thanks, I have used is_category to include a different template.

Topic Closed

This topic has been closed to new replies.

About this Topic