• salvopa87

    (@salvopa87)


    I am going crazy trying to understand why I cannot change the layout for the categoy.
    I have:
    Category 1: SubCat1, SubCat2 ….
    Category 2: Subcat1, SubCat2….
    So I need to have a different template for Category1 (and all the subcat) and another template for Cateogory2 and all the subcats.

    What I have done is to change single.php with if..else and get_template_part() which load a different file named single-xxxx.php each file represents the category. any idea why it doesn’t work? I have a blank page instead of a normal page.

Viewing 1 replies (of 1 total)
  • Tanay

    (@tanaykhandelwal-1)

    Hi salvopa87,

    Actually it works this way for the post types. For category you need to add the if..else condition in the single.php. Something like :-

    if( has_category('category_slug') ) {
       // do stuff
    } else {
       // go as it is
    }

    Regards,
    Tanay Khandelwal

Viewing 1 replies (of 1 total)
  • The topic ‘Creating different layout according to category and subcategory’ is closed to new replies.