How create color setting for wordpress theme using unyson framework?
It is not difficult. To start the created function we call what we like. Next, we are include an empty file custom_colors.css
.
Then we get custom style settings, for example, the background color $ color_bg
.
We make the first simple check.
$color_bg = (fw_get_db_settings_option('color_bg')) ? 'background-color:'.fw_get_db_settings_option('color_bg').';':'';
Then print a new color for the background of the site$custom_colors_css .= "
body{
{$color_bg}
}";
full script
function colors_settings() { //include empty css file wp_enqueue_style('custom-colors-style', get_template_directory_uri() . '/admin/css/custom_colors.css'); $custom_colors_css = ""; //Get background color $color_bg = (fw_get_db_settings_option('color_bg')) ? 'background-color:'.fw_get_db_settings_option('color_bg').';':''; //Print css styles $custom_colors_css .= " body{ {$color_bg} } "; }