I found 2 ways for my problem :
1- you can create a file with name “category.php” for all of your categories and then for every category that you want to add a diffrent style you should create a file like this>> “category-id.php” OR “category-name.php” .
2- another way is that you can do this work by if and else , you should use this code :
<?php if (in_category('name')) {
echo 'htmlcode';
}
elseif (in_category('name-2')) {
echo 'htmlcode';
}
else {
echo 'htmlcode';
}
?>
Related Posts:
- Meta query with boolean true/false value
- Why does my custom WP role need edit_posts to edit images?
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- How to filter by custom post type on Gutenberg “Latest Posts’ block
- Two Custom Post Types, Share Two Taxonomies
- Multisite wide post type?
- How to list/show all custom post types regardless of category?
- Remove CPT slug from URL
- How to sort a table of custom posts by column containing custom field
- I have a CPT that have menu_order enabled, how can I make the menu_order values unique so it won’t have duplicates
- WordPress metabox file upload in custom post [duplicate]
- tags & categories with custom post type
- Querying Posts by Taxonomy From Alternate Network Site
- working Custom Post Type and Widget code no longer works when moved from functions.php to plugin
- Archive filter disappears on no results?
- How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”
- How do I display custom post types through a common taxonomy?
- Add custom post type to Backbone collections
- pagination redirecting from page number url before page requested
- Get all of user’s custom post types in WP Admin for plugin
- Does anyone have a plugin that could automatically tag custom post types in wordpress?
- WordPress or Drupal for data-heavy content site
- Stop / prevent WordPress from updating permalinks of custom post type
- WP_Query: include custom post type only with specific meta value
- Relative URLs for a particular custom post type?
- How can I dynamically add a post to a custom post type which uses a custom field?
- get_comments not working on custom post types
- How can we take into account post types when constructing permalinks?
- Posts Categories Are Showing In The Custom Post Type Category
- ACF From & To Date Validations
- Displaying all taxonomies without custom posts?
- WordPress showing archive.php instead page
- Query Multiple Custom Posts by Custom Fields
- Modification of how the data is controlled/showed and stored
- WordPress Custom Post Type is not working properly
- Show fields based on taxonomy selection in editor
- Permalinks: custom structure for taxonomy – tags?
- Page not found for custom post type UI plugin and taxonomy
- How to Get the title of a custom field?
- Loop for custom post types filtered by a taxonomy
- Ordering Submenu Pages in WP 3.1
- Displaying custom post types by category
- Disable custom taxonomy on admin bar
- how to show records that don’t have custom meta value
- One Custom post type 404’s others don’t
- Api rest_route 404 while building filter for custom posts (filtered by multiple meta keys / custom fields)
- how to get this tax_query working?
- WordPress CPT custom custom label
- How do you output an unknown number of images in a custom post type with desired markup?
- Custom post type’s posts are not showing anywere but in xml sitemap
- I want to fetch custom post data based on it’s id i fetch from select drop down [closed]
- If Post type use sidebar (‘tree’)
- Using Image Sizes for Custom Post Types outside the Loop
- link featured image to external link
- How should I structure complex content hierarchies?
- Querying two different post types with the same taxonomony
- How to add page under a custom post type?
- Sort column on meta key and meta value
- Function to return values from metabox
- How do I enforce a specific custom post type on the loop
- Create a custom post type based on ‘Post’
- Wp Meta Query does not work while simple Query Works
- Add Content Column to Custom Post Type backend
- Custom fields for post or terms which don’t update on post update
- ForEach Loop iterates only once when inserting product variations
- How to embed script in custom post type with dynamic value
- Custom Post Type with Custom Taxonomy as Category post_type_link, after this code only the home page and the taxonomy page are opened
- How To Display Posts Of Custom Post Type At Page Template
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- multiple section
- How to add dynamic fields on wordpress custom post type page in admin section
- Custom Post type page content (archive page)
- Posts per Page on custom Taxonomy Template
- How to use POST method using custom wordpress button?
- Exporting CPT from dev site and import into live site?
- Custom fields for taxonomies with custom value for each post
- If custom taxonomy exist on post?
- Error [Column ‘post_title’ cannot be null] when title is disabled for Custom post type
- How to sort custom post’s category by id from the theme’s function.php?
- Permalinks for a custom post type – with a page template (custom query) and taxonomy archive
- How to add New Post On clicking a button?
- How to handle single entries of a custom post type?
- How to register rows (resource) from custom table as posts of custom type on-the-fly?
- Show first posts with custom field not empty and order all by title
- How to add base permalink to custom posts?
- post_type_exists keeps returning false
- Search page for custom post type
- Rewrite rules causing hole
- Issue on adding Icons to Custom Post Type
- Query a custom taxonomy for certain posts
- How can I sort posts ascending by post title for a specific post type, but on a category archive template?
- Save number of Facebook likes to database
- Random ID for custom post type
- Add /blog to the “post” post type url
- Pagination for custom post type on multisite not working
- Get Posts ordered by a date custom meta field
- Sortable admin columns ordering from custom fields isn’t combine com search and Dropdown filter
- Calling custom taxonomies
- Is it possible to use a post name in a custom post slug?
- How do I add the “orange counter” next to a Custom Post Type?