One option is to create a single category.php
file with conditionals. So, you would have something like this:
<?php
if(is_category('one') || is_category('un') {
// your code here
} elseif(is_category('two') || is_category('deux') {
// your code here
}
?>
This way you can still output different code per category, but you won’t have to copy category-one.php
to category-un.php
etc.
Related Posts:
- Categories Template Assistance
- Use template for posts with a particular category grandparent
- How to show single category archive
- how to show only specific category for a template
- To close or not to close php
- Display current category title on category page
- How does printf( __( ) ); work?
- Return HTML Template Page with PHP Function
- Why do templates contain so many PHP tag pairs?
- What does the token %1$s in WordPress represent [closed]
- Inject post (from specific category) between posts in Loop
- Is there a way to parse shortcodes in PHP?
- exclude multiple terms using get_terms() function
- Displaying a WooCommerce product via PHP
- What exactly does “Posts page” do in WordPress?
- Check if a menu is empty?
- Static Frontpage Pagination – Custom loop
- Get the php template file from other theme folder
- WordPress Template Engine?
- Getting key value of WP_Term object in wordpress
- retrieve thumbnail from post ID of best selling product in category
- How to have a custom display for both woocommerce archive and product-category pages? [closed]
- Custom HTML structure in wp_list_categories
- wp_remote_get returns an error for valid URL
- Counting number of posts in a category and its sub categories and displaying result using shortcode
- Allow authors to post only in categories they create in WordPress
- Archive listing of posts by publish year (multiple years)
- On this day PHP code
- How to loop over custom fields in a page template?
- Add custom field to attachments in a specific category
- Blank on static home page?
- How to Remove Parents Category Permalink from Posts
- Display all posts in current category
- How to Populate the list of custom post type categories
- Php string not working in WordPress Functions.php [duplicate]
- Looking to exclude blog posts from category Previous/Next buttons
- WordPress theme & site not loading after moving files
- List all categories but exclude current post category on single post page
- Adjust the results quantity for Search Results page pagination
- Exclude pages with certain template from wp_list_pages
- How to display related posts from parent category
- User Defined order on get_categories?
- How can I set custom order use this function
- Use Timber/Twig to pull an image by image ID [closed]
- Is it possible to use the featured image of a page as a css background without inlining?
- Edit category output
- Unable to set right time in admin and frontend template
- Easiest way to show total number of subpages
- Error: array_map(): Argument #2
- Problems with function on function.php
- Switching between custom templates in a post type of the admin menu
- Put a link to a category round a hard coded A HREF
- Check if Product is in a Specific Category in Functions.php
- Custom Loop through category menu to include sub categories
- Blank space at beginning of tag?
- Different background-image by category
- Placing the_content inside shortcode not working
- Link to file in plugin directory from wordpress template?
- Get posts with at least one category in common with current post?
- Password protecting content in custom template
- How to exclude specific category from the get_the_category(); array
- Code to pull in a PHP file named after the category ID
- Add HTML Attributes To Anchor Tags In `wp_list_categories()` Function
- How to override wp-admin styling
- Woocommerce – remove product from category
- Get category name from custom loop and echo it once
- Display all categories including sub categories
- Add a Second Menu to a theme that only support 1 menu
- Custom excerpt function re-factoring
- Inject PHP code into “sidebar-content” – code before my WooCommerce sidebar widget?
- How to display user nickname (not display name) in PHP template?
- Custom Template 404 for specific custom post type
- An unwanted inline style is added to my body tag
- How to properly insert a link to a template in WordPress?
- Custom category code not showing all posts
- Custom field value not saving when it contains a URL?
- Category Thumbnail Display – How to display ONLY the main Category
- Where do posts get the sidebar from?
- Automatically add custom CSS to new posts using a category template
- Render ninja form inside markup
- hover image appears below placeholder instead of overlayed
- combine Code 1 with Code 2
- get current product name in functions.php
- get post based on category chosen in drop down – The ajax method
- How to use transient in this code for related post?
- How can I load a PHP page without using a Template?
- Creating a related post section based on similar categories
- Swapping wp_dropdown_categories function with wp_category_checklist
- how could I load a different template part by page
- Proper syntax or method for keeping url in modified isotope / category links
- Filter Select results based on selection
- creating a second image attachment template?
- Mass update excerpt
- What is an equivalent of single_cat_title for getting the slug of the category?
- Issue adding sub category programmatically
- How can I get a single php file that is the equivalent of an existing WordPress page?
- How to exclude category ID from Looper in WordPress
- Add a specific part of current category page url to shortcode
- how do I get a specific post from a post with a subcategory in WP
- Get and insert order email address to the PHP template inside HTML text