If your theme has body_class() in the body tag (normally in header.php) then the category name is added to the body tag as a class e.g.
<body class="my-category">
So in a css file you can do
.my-category #my-element {
background:#FF0000;
}
To edit the html for the categories to make them card layouts then you would need to edit the category.php file (or create one if your theme is missing it).
Put the html for the cards in the_loop
Related Posts:
- WordPress Shortcode and Dynamic CSS
- Looking to exclude blog posts from category Previous/Next buttons
- Multiple pages on one with different HTML
- Minify HTML, CSS, JS with PHPWee?
- How to display a value from a radio button in the options menu in wordpress
- Different background-image by category
- Add HTML Attributes To Anchor Tags In `wp_list_categories()` Function
- Shortcode content output but not in correct place
- An unwanted inline style is added to my body tag
- Show post in slider
- How can I hide Home in my menu in a specific page?
- Missing sidebar parameter “fix” – before_content
- How Display Posts on category
- how to remove metadata from the posts of my blog?
- Where in PHP do I move title and meta (date) to bottom of each blog section?
- WP grandchild categories in nested ul li
- selected option if current category is the value
- Customize position of social icons in upme plugin [closed]
- How create a Shortcode with hover and complex options
- WordPress Multiple Navigation bars
- Auto 301 to full post permalink? (using : /archive/%post_id% to %post_name% )
- How do I add a custom css to all posts without affecting homepage css? [closed]
- Wrapping a Sidebar within
- Add Codepen animation as Preloader to WordPress
- Creating a blog on my companies new website using WordPress but I have sidebar issues
- Where can I find the inline-css of my theme header?
- Menu Custom Data Attributes
- Highlight the links without using dropdown
- Website completely messes up when logging out
- Need help removing […] after excerpt
- Link to page with posts of specific type
- Displaying images outside the content
- how to changes mobile menu toggle breakpoint in WordPress
- Background image no longer fits to screen now that project is in php files
- List sub categories and corresponding posts of a parent category
- Add other class content with reference class value
- PHP function for horizontal Woocommerce thumbnails and badges
- I can’t go to the page archive-{post_type}.php
- admin panel – How to remove “delete” button from category editing page
- dynamic php menu with hidden sub-categories only showing when the category name is clicked
- Help me I cannot link my font-awesome to my WordPress Theme. I have my font-awesome folder already in my project
- Drop down question
- How to enable HTML tags in category description without breaking the category page
- WP Website is shown in HTML
- Can’t display anything through homepage text editor
- How to find and delete a menu item in php?
- WordPress Slider is not working
- How to display post meta bellow every posts
- how to add functions to my function.php using a child theme?
- Show subcategory name selected in specific category woocoommerce
- Make a full-width wordpress page
- Blog Image and Title in Right Sidebar
- Target a specific container to style on WordPress storefront theme
- How to include different html tags in the header for different pages?
- user update profile for custom code
- Code works on page-example.php by not category-example.php
- Font-Family does not looks like how it should be [closed]
- Where to find the html for WordPress site? [closed]
- How to add style in functions.php depending on conditions?
- Show contact 7 form in popup
- WordPress – Image href for home menu nav not working
- How Can I Center the Logo in the Navigation Menu? [closed]
- featured post as div background
- Trying to customize wordpress drop down categories
- Cant get theme to change footer color through theme customizer
- How to customize posts in WordPress by using HTML and CSS?
- WP_Query not returning results
- Header location [closed]
- How do I link the side images?
- Parse error: syntax error, unexpected ‘}’ in
- Sorting Problem
- How to create a container in php then customise it in CSS
- Custom HTML/CSS Theme into WordPress – SEO considerations
- ‘This Field is Required.’ is Not Displaying on CF7 [closed]
- How to create different templates for woocommerce single-product.php?
- Add custom HTML to posts page
- wp_enqueue_style with style.php and WordPress functions
- How to only show page id as body class?
- Displaying theme options in css
- Input data from email form not going to JSON file
- Search WordPress using static html page
- Change “No Comments” link to “My String” on Blog Post (Find Snippet in Code or use CSS, PHP Solution) [closed]
- How to get category name or ID by post?
- Using featured image of blog archive page
- Listing titles and custom fields of entries within subcategories
- Separate array output into a
- Dividing the loop to style post differently
- Adding attribute to the post.php form tag in wp-admin
- How to sort posts by active category in WordPress?
- Add css class to string
- WordPress custom php script to match standard page layout
- Get parent category name when only child category is applied to a product
- How to use wp_ajax_set_post_thumbnail?
- Passing a value from an input field to a php function in WordPress?
- Google CSE Malfunctions via Chrome/Safari on Mobile When Clicking on Either Search Icon/Menu Icon. How to Make Google CSE Default Theme Search
- Query seems to be duplicated
- Top menu disapears in Category Pages when filtering using ACF
- nested divs, classes for a grid in loop [duplicate]
- Category List in Theme Options Page
- How to modify default tags in wp_head()