-
Hello!
I am trying to change the background color on a single specific page of my website.
I found this topic in the old forum, that gives a solution that I found simple:
https://generatepress.com/forums/topic/want-to-change-the-background-color-on-a-single-page/So, I added the following inline CSS to the page, using a Custom HTML block
<style>
/* CSS code goes here */
body {
background-color: lightblue !important;
}
</style>The background color did change to lightblue, but the content area background didnt (it’s white as configured in the Customzier”. Print screen here https://tinyurl.com/298acfn7
Can you help me with the inline CSS code to change both background and content area background or suggest another solution ti achieve it?
Thank you,
André -
Alvind
Hi there,
Could you provide the link to the specific page where you’re trying to change the background color?
-
Hi Alvind,
Here is a clone of the page, as the original is still under work and I dont want to publih yet.
https://www.tempodeviajar.com/new-test-recursos-de-viagem/Thanks
-
Alvind
Remove the Custom HTML block you’ve added earlier and then add this PHP snippet:
add_action( 'wp_head', function() { if ( is_page('new-test-recursos-de-viagem' ) ) { ?> <style> body, #content { background-color: lightblue; } </style> <?php } });
You just need to replace the
new-test-recursos-de-viagem
slug with the actual slug of the page where you want to change its background color.Adding PHP: https://docs.generatepress.com/article/adding-php/
-
Worked great. Thank you!
-
Alvind
You’re welcome!
- You must be logged in to reply to this topic.