示例#1
0
 function __construct($values = array(), $input_name = '')
 {
     if (function_exists('st_google_font_to_options')) {
         $this->fonts = array_merge(st_get_normal_fonts(), st_google_font_to_options());
     }
     // echo "<br/>".var_dump(st_google_font_to_options())."</br/>";
     $this->values = $values;
     if (empty($values)) {
         $this->is_default = true;
     }
     if ($input_name != '') {
         $this->name = $input_name;
         $this->meta_name = $input_name;
     }
 }
示例#2
0
function st_theme_customizer($wp_customize)
{
    $normal_font = st_get_normal_fonts();
    $g_fonts = st_google_font_to_options();
    $fonts = array();
    foreach ($g_fonts as $k => $v) {
        $fonts[$k] = $k;
    }
    foreach ($normal_font as $k => $v) {
        $fonts[$k] = $k;
    }
    $name = ucfirst('smooththemes');
    $wp_customize->add_section('_st_heading_font', array('title' => 'Fonts ', 'description' => ''));
    // ------------------- FOR PAGE MOD  ------------------------
    $wp_customize->add_section('_st_page_mod', array('title' => 'Page Mod ', 'description' => ''));
    $wp_customize->add_setting('page_full_boxed', array('default' => 'b'));
    $wp_customize->add_control('page_full_boxed', array('label' => 'Boxed of Full-Width Layout', 'section' => '_st_page_mod', 'type' => 'select', 'choices' => array('f' => __('Full-Width', 'smooththemes'), 'b' => __('Boxed', 'smooththemes'))));
    // ------------------- END FOR PAGE MOD  --------------------
    // ------------------- FOR SKIN  ------------------------
    $wp_customize->add_section('_st_global_skin', array('title' => 'Global Skin ', 'description' => ''));
    global $predefined_colors;
    $wp_customize->add_setting('predefined_colors', array('default' => '16A1E7'));
    $wp_customize->add_control('predefined_colors', array('label' => 'Pre-Defined Skins', 'section' => '_st_global_skin', 'type' => 'select', 'choices' => $predefined_colors));
    $wp_customize->add_setting('enable_custom_global_skin', array('default' => 'n'));
    $wp_customize->add_control('enable_custom_global_skin', array('label' => 'Enable custom global skin', 'section' => '_st_global_skin', 'type' => 'radio', 'choices' => array('y' => __('Yes'), 'n' => __('No'))));
    $wp_customize->add_setting('custom_global_skin', array('default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color'));
    // sanitize_hex_color_no_hash();
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'custom_global_skin', array('label' => 'Custom Global Skin', 'section' => '_st_global_skin')));
    // ------------------- END FOR SKIN ------------------------
    // ------------------- FOR background ------------------------
    $wp_customize->add_section('_st_background', array('title' => 'Background ', 'description' => ''));
    $wp_customize->add_setting('bg_color', array('default' => '#cccccc', 'sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color'));
    // sanitize_hex_color_no_hash();
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'bg_color', array('label' => 'Color', 'section' => '_st_background')));
    // ---- back fround image
    $wp_customize->add_setting('bg_img', array());
    $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'bg_img', array('label' => 'Background image', 'section' => '_st_background')));
    // select bg positon
    $wp_customize->add_setting('bg_positon', array('default' => 'tc'));
    $wp_customize->add_control('bg_positon', array('label' => 'Postion', 'section' => '_st_background', 'type' => 'select', 'choices' => array('tl' => __('Top left', 'smooththemes'), 'tc' => __('Top center', 'smooththemes'), 'tr' => __('Top right', 'smooththemes'), 'cc' => __('Center', 'smooththemes'), 'bl' => __('Bottom left', 'smooththemes'), 'br' => __('Bottom right', 'smooththemes'), 'bc' => __('Bottom center', 'smooththemes'))));
    $wp_customize->add_setting('bg_repreat', array('default' => 'r'));
    $wp_customize->add_control('bg_repreat', array('label' => 'Background Reapeat', 'section' => '_st_background', 'type' => 'select', 'choices' => array('r' => __('Repeat', 'smooththemes'), 'n' => __('No repeat', 'smooththemes'), 'x' => __('Repeat X', 'smooththemes'), 'y' => __('Repeat Y', 'smooththemes'))));
    $wp_customize->add_setting('bg_fixed', array('default' => 'n'));
    $wp_customize->add_control('bg_fixed', array('label' => 'Background fixed', 'section' => '_st_background', 'type' => 'select', 'choices' => array('n' => __('No', 'smooththemes'), 'y' => __('Yes', 'smooththemes'))));
    // ------------------- END  FOR background ------------------------
}