-
AuthorPosts
-
August 30, 2013 at 12:56 pm #28714
Hi,
hope that this is not too complicated … I would like to style the category names in the minor-meta line beneath the post title in that way, that each of my 4 categories get another color – but only in this line, this category name/link should get another color.
Means, that if there’s the category name “AAA”, then this linked category name should be for example #FF0000;
or if the category name there is “BBB”, then this linked category name should be ##04FF00; etc.
I’ve tried it with something like that, without any effect:
#top .category-36 .post-meta-infos a {
color: #ff0000 !important;
}I have googled a lot and searched for plugins to do this or a tutorial, but I haven’t found anything.
Can anybody help me out please with some code or with a tutorial source or plugin, where I can search for more infos?
Thanks a lot, appreciate
August 31, 2013 at 4:48 am #138406Hey,
You can use the nth-child css selectors: http://css-tricks.com/how-nth-child-works/
Regards,
Ismael
August 31, 2013 at 6:10 am #138407Thanks a lot, but your link describes something about lists and the minor-meta category names are as I see it, no lists?
I’ve tried with a lot of try and error with my low CSS knowledge this:
.category-36 .post-meta-infos a[rel] {
color: #ff0000 !important;
}This code shows the category name in a single post (!!!) NOT COLOURED, but at a category archive page, which contains posts of this category, it is right coloured:
and with Firebug:
But when I view only this single post, it is no more coloured.
Another error: if I’m on the category archive page of cat-36 for example, and the post is set to cat 36 and cat37, too, then both category names are coloured (in posts on the category archive page of cat36).
In a single post the category name of one of my 3 top cats should each get there another colour.
August 31, 2013 at 4:25 pm #138408Hi,
I’m not sure if this is what you want but if you use the nth child selector. You’ll have this effect:
This is the code for the image above:
.blog-categories.minor-meta a:nth-child(1) {
color: red;
}
.blog-categories.minor-meta a:nth-child(2) {
color: blue;
}
.blog-categories.minor-meta a:nth-child(3) {
color: green;
}Regards,
Ismael
September 2, 2013 at 3:16 pm #138409Thanks a lot, I have used your CSS, on a single post view, I have now these 3 coloured for 3 categories, but on the blog overview page it looks now like this – although there are 3 different categories, they all are red:
Each category should have its own colour – no matter if it’s the blog overview page with several posts on it from various categories, or if it’s a category’s archive page or if it’s a single post.
The name of category A should, for example, always appear red, the name of category B always blue, and the name of category C should always appear green – no matter on what view/page/post.
September 3, 2013 at 4:28 am #138410Hi,
The screenshot I posted above is the Blog Overview page. The category color looks the same on the single post view.
Regards,
Ismael
September 3, 2013 at 8:42 am #138411My screenshot has gone lost – here it is again and shows, why this does not work properly:
Different categories have the same color at the blog overview page. But each cat should have its own colour – no matter where.
September 4, 2013 at 4:27 pm #138412Hi colorit2,
Unfortunately that really isn’t doable as far as I know. You would need some kind of customization on the WordPress tags to always wrap them in their own custom class name.
Regards,
Devin
September 4, 2013 at 8:39 pm #138413okay, thanks, Devin.
-
AuthorPosts
- The topic ‘Styling the category tags within the line under the post's title (minor-meta)’ is closed to new replies.