if you can use template_redirect
hook and a simple function to set the template to use
add_action( 'template_redirect', 'category_set_redirect' );
function category_set_redirect(){
//create the sets of categories
$first_set= array("1","2","3","4","5","6");
$second_set= array("7","8","9","10","11","12");
if (is_category()){
if (in_array(get_query_var('cat'),$first_set)){
include(TEMPLATEPATH . "/first_category.php"); // include the corresponding template
die();
}
if (in_array(get_query_var('cat'),$second_set)){
include(TEMPLATEPATH . "/second_category.php"); // include the corresponding template
die();
}
}
}
Related Posts:
- Custom page for WooCommerce’s /product-category/
- Template for product-category page [closed]
- How to differentiate the homepage structure from the category page structure in WordPress template?
- Preventing index.php?category_name=something from redirecting
- Different templates for parent and children categories/taxonomies
- Display only deepest category on a single post?
- How do I set a specific template for sub-categories?
- Exclude a category from the filed under list only on some templates
- Create single.php for specific category by category id
- is_archive() content being shown instead of is_category()
- Alphabetizing Posts in a Category Page?
- How to control template resolution if both Author and Category filter in place?
- Which php file lists all the post of a category
- Why is this category page limiting the number of posts?
- Apply custom category template to subcategories
- Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !
- Code to pull in a PHP file named after the category ID
- Exclude category from Tag Template
- How to make a Thumbnails Mosaic
- Are Category or Tag Archive Pages Possible?
- Possible to make a subdirectory that loops through a single category?
- Need Category RSS Feed that shows all posts
- WooCommerce IF statements not working
- Making a tourism information website [closed]
- Set a them for all subset of category
- Highlight wp_nav_menu when category is selected
- Archive.php filtered by pre-determined category
- one category template for multiple categories
- Different templates for different category tags
- The default code for “posts_nav_link” on category.php isn’t working
- Only one post is showing on category page, why?
- Updating category template to change how subcategories display
- Categories overview that links to page displaying posts
- How can I get categories IDs if multiple categories requested via URI?
- display posts from specific category on a page , in thematic child theme?
- Category template to show different categories based on parent
- Page display certain Category Posts
- Does “show_option_all” in wp_list_categories do anything?
- How can I improve this taxonomy treating approach?
- Sub category templates
- Custom taxonomy template for categories
- Add a custom category page in WordPress.org
- How to insert category list into post creation page, and retrieve chosen categories?
- List all posts in a category with query_post() function
- Limit number of posts on a custom category template – breaking pagination
- Problem with different query loops (and “main loop”) on category template page!
- How can I display the number of post associated to a category in Twig/Timber WordPress? [closed]
- Is it possible to have a template that works on multiple categories where the link address contains the specific category?
- Custom template for sub-sub-categories
- What Must to Display the “mysite.com/category” URL?
- How to get the current category with custom posts
- Home Page Template – Specific Category
- How to use wp_list_categories with plugin category?
- Why is my sub-category template showing the wrong posts
- Add Date & Author Meta to Category Archive Page
- Display subcategories selectbox on each category page
- Displaying year once in category.php [duplicate]
- Custom Page Template Category loop not functioning correctly
- Category link redirect to custom template page instead of index.php?
- I would like to feature a tip on the homepage
- Assigning certain pages or posts to use the template of the parent page or category
- How can I include custom category and tag base in template files?
- Different header for each category
- Category Template – Show Last Entry as Featured
- Detect category choice for posts with multiple categories
- Custom post type archive category page results in 404
- Include home page template in specific category template
- Output Title of Post’s Current Category
- Showing different posts on category pages
- Displaying categories in different template problem
- Include last post date in get_categories loop
- Add custom categories and subcategories and posts as custom pages
- How to list posts from a sub-category that is listed in a parent category (more details below)?
- Show alternative menu based on page template AND post category
- Custom Archive Template for Multiple Categories
- Adding a category view to a page
- Using a template page parent breaks page
- the_content() not showing full posts in category template
- Use different file includes for single.php
- Display Taxonomies in loop with template args
- Choosing different templates for categories
- Show posts from all categories
- Getting page/category content to show up in my custom page template
- Most efficient way to have 1 template for parent, 1 template for child categories?
- Category Templates for Post Types not Working
- Own Custom Tags/Category page ( posts)
- One category not displaying template updates
- WordPress a template for subcategories fo a given category, but not for root category
- Paginate WordPress Category Pages
- How do I get a single page navigation depending on the previous page?
- Dynamically Adding Category Specific Content To Specific Category & Subcategory Pages
- Custom Fields to Category edit page, then displaying them in a template correctly
- Template files not working for archives and categories
- Category Template – to be editable from the backend?
- 2 Categories using same template but one has a problem? [closed]
- What defines a post as portfolio page content?
- Why does my category page display “posted on…” when all I want it to do is display categories?
- How to create a template for categories
- How to load/include category templates based on conditionals?
- how to create a page that shows all of multiple category posts on a single page