This code adds a color picker to the Edit Post screen enabling you to set the background color for each post ( Not the front page archive page background ) without adding CSS, editing default code or using any plugins.
It styles each posts entry class on your archive pages, in this example, the home or posts page.
However, if you want to use a custom field plugin like ACF or Toolset, create a field named
background_color is your custom field key.
The code adds your background color using the color picker added to the Edit Post screen without using code to create a new loop.
Shows the color picker added to the Edit Post screen enabling you to set the background color of the entry when it displays on your posts page.
Works in any WordPress theme and tested using the Genesis Sample child theme by StudioPress.
There’s 2 steps :
- # Copy & paste the PHP code ( without the opening PHP tag ) to the end of your child themes functions file.
- # On the Edit Post screen, choose the color for each specific post background.