Answer the question
In order to leave comments, you need to log in
Custom css for specific wordpress post category?
There is the latest version of WordPress
There is a template
there is an "Option Tree" management plugin attached to it
wordpress.org/plugins/option-tree
How can I use this base to make sure that, for example, the entire site has one css file, the category with id 1 has another , a with id 2 is the third one.
In fact, only the colors will change.
Is there any plugin for this?
Answer the question
In order to leave comments, you need to log in
Specifically, to solve the task, you need to modify the header.php file of the theme, where, depending on the category (if (is_category('name'))), load the appropriate CSS instead of the regular one. But this way is wrong.
The correct one is to add rules to the style file that apply only to a particular category. The body tag (if the theme is done properly) contains the appropriate classes (as an example):
In the style file, respectively, you can write:
body.category-bez-rubriki .тут-нужный-селектор {
/* тут правила */
}
redefining all css for only two categories is somehow not reasonable. Better than selectors. wp has the ability to set a class for body depending on where you are.
strange requests as for me, but in fact - multiselectors ala #one .two div to help.
if( is_category( $category ) ){
wp_enqueue_style ....
}
https://wp-kama.ru/function/wp_enqueue_style
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question