Using categories in CSS | WordPress.org

[ad_1]

Plugin Author
room34

(@room34)

Hi, thanks for your interest in doing more with the CATEGORIES field. So far I’ve only bothered to provide minimal support for it since, as you noted, most of the major providers, frustratingly, do not use the field.

While there is no automatic CSS styling for categories, the data does get included in the HTML output if the feed actually contains them. This is handled via the data-categories attribute. The value inserted into that attribute is the exact text of the CATEGORIES field from the feed.

So the key to using this in CSS is properly formatting the selectors. You’ll want to use wildcards in case the event has multiple categories. For instance, if your category is “Meetings” then your CSS selector would be:

.event[data-categories*="Meetings"]

If any aspects of this CSS selector structure are unfamiliar, here’s an online reference:

https://www.w3schools.com/cssref/css_selectors.php

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer