A sage 9 based theme should offer an option for displaying a decorative element - using a separate template just for enabling this on a per-page basis seems to be overkill.
What is the best practice approach for this?
Not sure I understand what you’re saying, especially related to the title. Can you provide a use-case or example?
Yes, let’s say a theme offers a different footer background.
The user should be able to select this different footer background on individual pages.
Except looking different, there is no difference otherwise.
I usually use ACF Options Pages for this, but you could just as easily use Redux Framework or Customizer settings. It’s a developer’s choice, really.
1 Like
I’d probably do something like:
- Allow users to set a particular meta field on posts/pages (i.e. w/ ACF, Carbon Fields, manually, however) that determines if the alternative background should be shown.
- Create a blade that checks that meta field and displays the appropriate background, and
@include
it on mysingle
template (or wherever would be most appropriate).