- This topic has 7 replies, 2 voices, and was last updated 4 years, 1 month ago by
David.
-
AuthorPosts
-
May 4, 2018 at 11:48 pm #567961
Lars
Hi, I wonder if there is any option to set so I can get another background color on a blog post. For example, the default color is white, but some posts can be set in another background color. / Lars
May 5, 2018 at 3:40 am #568032David
StaffCustomer SupportHi Lars,
The simplest option would be to use the Simple CSS plugin. Then you can add page specific CSS via the meta box provided in the page editor and use this code:
body { background-color: #AABBCC; }
Adding CSS: https://docs.generatepress.com/article/adding-css/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/May 7, 2018 at 3:49 am #569471Lars
Hi David!
Thank you very much for the reply. I realized that I did not put my question correctly. What I’m looking for is the background color of the content area. The background color of the post should therefore be unique to just one post. Hope you understand what I mean. / Lars
May 7, 2018 at 4:20 am #569484David
StaffCustomer SupportHi Lars
are you using a single container or separate container layout?
For single container this:
.container { background-color: #AABBCC !Important; }
For separate containers you can do this:
.inside-article, .comments-area { background-color: #AABBCC !important }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/May 7, 2018 at 4:39 am #569487Lars
Hi!
I use separate container layout, thanks now I got it.One last question for now, is it possible that the background color is also visible in the blog flow? / Lars
May 7, 2018 at 4:48 am #569494David
StaffCustomer SupportSo each article has a different background color?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/May 7, 2018 at 6:54 am #569603Lars
Letś say that I have 5 posts on my blog flow, all have the default background color in the container, all except post 2 that has a red background container. /Lars
May 7, 2018 at 7:28 am #569639David
StaffCustomer SupportThats a fun one. Not easy, but how about we use Taxonomies to style the different backgrounds?
By default WP adds the taxnomies as classes to the article e.gcategory-red
ortag-blue
so you can use them to style elements like so:.tag-red .inside-article, .tag-red ~ .comments-area { background-color: red; }
Now any article with a Tag of Red will get those styles. Just create a library of tag colours as you go =) And you can scrap the above CSS as this will apply to blog and single posts.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.