Just wondering if there is any way to either dynamically set the background color of a container, or set a class on a container for a content template (or the content template wrapper).
I have a content template setup for my archives and want to allow the user to select a background color for one of the inner containers. Ideally I would use an ACF select field to give the user some pre-set options for classes or colours.
Not really. I need to do it per-post. So.. on render of the content template (for each post), get the value of the ACF field and either add a class to the article or inline style to the container.
Yes, you can do that. Either add an inline style depending on the returned value of your ACF field.
You can basically use the render_block filter to render the Block with your ACF “style”. Or you can append a class and utilize this class to associate a specific background color depending on the custom field.