I have created an admin options page (using the Redux Theme Framework), in which the admin can customize the website's appearance (text color, background color, background repeat options, etc.. ).
Let's suppose i want to give my user the possibility of setting a custom background for a section. Admin-side, i have a media uploader form (unique id: my_div_background_url).
In the frontend, I can retrieve this option and then echo it like this:
<?php $options = get_option('my_theme'); $section_background_url = $options['div_background_url']; echo '<section style="background-image: url(\'' . $section_background_url . '\');"></section>'; ?>
My question is: is this the right and best way to do this? Wouldn't it be better if all of my options were saved in a css file whenever the admin changes them, and then having this file included in my website? Or are there others methods?