0

I was wondering if there is a way to set a different background for each page. I tried with this code you posted on a different thread, but it didn’t work:

section-padding.page-id-8  {
background-color: #e0e0e0;

}
  • What theme are you using? – Brad Dalton Aug 5 '15 at 13:50
  • Probably the best way to go about it would be to make a custom field for background color (or use the free version of ACF) and then populate that entry inline in your style in the header. That way you can a) have a fallback if none is set and b) allow ease of updating. – Aibrean Aug 5 '15 at 13:56
  • @BradDalton I think it's Swiss Progress. clientswissprogress.com/wp-content/themes/… – 5ervant Aug 5 '15 at 13:56
1

Yes, that's possible! For the default homepage, you can use this:

body.home {
  background-color: #ff0000;
}

For a specific blog post, you can use this where 5 is its post ID:

body.postid-5 {
  background-color: #00ff00;
}

And this is for a specific page and it's the same where 5 is the page ID:

body.page-id-5 {
  background-color: #0000ff;
}
  • This solved the OP's question according to his/her answered comment, any reason for the down-vote? – 5ervant Aug 6 '15 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.