theme_style( $wp_customize ); $this->theme_store( $wp_customize ); } function theme_style( $wp_customize ) { $wp_customize->add_section( 'mino_theme_style_customizer' , array( 'title' => __( 'Background and Layout', 'mino' ), 'priority' => 150, ) ); $wp_customize->add_setting( 'mino_theme_color_customizer_set' , array( 'default' => apply_filters( 'mino_set_default_theme_color', '' ), 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_theme_color' ), ) ); $wp_customize->add_control( new Mino_Customize_Theme_Control ( $wp_customize, 'mino_theme_color_customizer_ctrl', array( 'label' => __( 'Choose themes color', 'mino' ), 'section' => 'mino_theme_style_customizer', 'settings' => 'mino_theme_color_customizer_set', ) ) ); /* Layout bar themes */ $wp_customize->add_setting( 'mino_theme_layoutbar_customizer_set' , array( 'default' => apply_filters( 'mino_set_default_layoutbar', 'full' ), 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_theme_layoutbar' ), ) ); $wp_customize->add_control( new Mino_Customize_Theme_Layoutbar_Control ( $wp_customize, 'mino_theme_layoutbar_customizer_ctrl', array( 'label' => __( 'Choose theme layout', 'mino' ), 'section' => 'mino_theme_style_customizer', 'settings' => 'mino_theme_layoutbar_customizer_set', ) ) ); /* Layout themes */ $wp_customize->add_setting( 'mino_theme_layout_customizer_set' , array( 'default' => apply_filters( 'mino_set_default_layout', 'wide' ), 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_theme_layout' ), ) ); $wp_customize->add_control( 'mino_theme_layout_customizer_ctrl', array( 'label' => __( 'Choose theme style', 'mino' ), 'section' => 'mino_theme_style_customizer', 'settings' => 'mino_theme_layout_customizer_set', 'type' => 'radio', 'choices' => apply_filters( 'mino_set_theme_layout_choice', array( 'wide' => 'Wide', 'boxed' => 'Boxed' ) ) ) ); /* Display background pattern or not */ $wp_customize->add_setting( 'mino_show_bg_pattern_set', array( 'default' => 0, 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_bool_options' ), ) ); $wp_customize->add_control( 'mino_show_bg_pattern_ctrl', array( 'label' => __( 'Display background pattern', 'mino' ), 'section' => 'mino_theme_style_customizer', 'settings' => 'mino_show_bg_pattern_set', 'type' => 'checkbox' ) ); /* Background pattern */ $wp_customize->add_setting( 'mino_bg_pattern_customizer_set' , array( 'default' => apply_filters( 'mino_set_default_bt_pattern', '' ), 'transport' => 'refresh', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new Mino_Customize_Background_Pattern ( $wp_customize, 'mino_bg_pattern_customizer_ctrl', array( 'label' => __( 'Choose background pattern', 'mino' ), 'section' => 'mino_theme_style_customizer', 'settings' => 'mino_bg_pattern_customizer_set' ) ) ); /* Show breadcrumbs */ $wp_customize->add_setting( 'mino_breadcrumb_customizer_set' , array( 'default' => apply_filters( 'mino_set_default_breadcrumb_area', array( 'post', 'page', 'attachment', 'archive', 'tags', 'category', 'search', 'author' ) ), 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_breadcrumb' ) ) ); $wp_customize->add_control( new Mino_Customize_Breadcrumb_Control ( $wp_customize, 'mino_breadcrumb_customizer_ctrl', array( 'label' => __( 'Display breadcrumb', 'mino' ), 'section' => 'mino_theme_style_customizer', 'settings' => 'mino_breadcrumb_customizer_set', 'choices' => apply_filters( 'mino_set_breadcrumb_area', array( 'post' => 'Post', 'page' => 'Page', 'attachment' => 'Attachment', 'archive' => 'Archive', 'tags' => 'Tags', 'category' => 'Category', 'search' => 'Search', 'author' => 'Author' )) ) ) ); /* Set Search Form Header */ $wp_customize->add_setting( 'mino_search_form_customizer_set' , array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_bool_options' ), ) ); $wp_customize->add_control( 'mino_search_form_customizer_ctrl', array( 'label' => __( 'Display search form header', 'mino' ), 'section' => 'mino_theme_style_customizer', 'settings' => 'mino_search_form_customizer_set', 'type' => 'select', 'choices' => apply_filters( 'mino_set_options_search', array( 0 => __( 'No', 'mino' ), 1 => __( 'Yes', 'mino' ) ) ) ) ); /* Display index post thumbnail */ $wp_customize->add_setting( 'mino_index_thumbnail_customizer_set' , array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_bool_options' ), ) ); $wp_customize->add_control( 'mino_index_thumbnail_customizer_ctrl', array( 'label' => __( 'Display index thumbnail', 'mino' ), 'section' => 'mino_theme_style_customizer', 'settings' => 'mino_index_thumbnail_customizer_set', 'type' => 'select', 'choices' => apply_filters( 'mino_set_options_thumbnail', array( 0 => __( 'No', 'mino' ), 1 => __( 'Yes', 'mino' ) ) ) ) ); /* Display archive post thumbnail */ $wp_customize->add_setting( 'mino_archive_thumbnail_customizer_set' , array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_bool_options' ), ) ); $wp_customize->add_control( 'mino_archive_thumbnail_customizer_ctrl', array( 'label' => __( 'Display archive thumbnail', 'mino' ), 'section' => 'mino_theme_style_customizer', 'settings' => 'mino_archive_thumbnail_customizer_set', 'type' => 'select', 'choices' => apply_filters( 'mino_set_options_thumbnail', array( 0 => __( 'No', 'mino' ), 1 => __( 'Yes', 'mino' ) ) ) ) ); /* Related Info */ $wp_customize->add_setting( 'mino_related_story_customizer_set' , array( 'default' => 1, 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_bool_options' ), ) ); $wp_customize->add_control( 'mino_related_story_customizer_ctrl', array( 'label' => __( 'Display related post', 'mino' ), 'section' => 'mino_theme_style_customizer', 'settings' => 'mino_related_story_customizer_set', 'type' => 'select', 'choices' => array( 0 => __( 'No', 'mino' ), 1 => __( 'Yes', 'mino' ) ) ) ); /* Author Info */ $wp_customize->add_setting( 'mino_author_info_customizer_set' , array( 'default' => 0, 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_bool_options' ), ) ); $wp_customize->add_control( 'mino_author_info_customizer_ctrl', array( 'label' => __( 'Display author info', 'mino' ), 'section' => 'mino_theme_style_customizer', 'settings' => 'mino_author_info_customizer_set', 'type' => 'select', 'choices' => apply_filters( 'mino_set_options_author', array( 0 => __( 'No', 'mino' ), 1 => __( 'Yes', 'mino' ) ) ) ) ); /* Customizer Ads Slot */ $wp_customize->add_section( 'mino_theme_ads_customizer' , array( 'title' => __( 'Mino Pro', 'mino' ), 'priority' => 150, ) ); $wp_customize->add_setting( 'mino_theme_ads_set' , array( 'default' => '', 'sanitize_callback' => array( $this, 'mino_sanitize_bool_options' ), ) ); $wp_customize->add_control( new Mino_Customize_Ads_Display ( $wp_customize, 'mino_theme_ads_ctrl', array( 'label' => __( 'Mino Pro', 'mino' ), 'section' => 'mino_theme_ads_customizer', 'settings' => 'mino_theme_ads_set', ) ) ); } function theme_store( $wp_customize ) { /* New Section - Store */ $wp_customize->add_section( 'mino_theme_store_customizer' , array( 'title' => __( 'Store Homepage', 'mino' ), 'priority' => 150, ) ); /* Store - Support */ $wp_customize->add_setting( 'mino_store_support_customizer_set' , array( 'default' => apply_filters( 'mino_set_default_store_support', '' ), 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_text' ), ) ); $wp_customize->add_control( 'mino_store_support_customizer_set', array( 'label' => __( 'Support Line', 'mino' ), 'section' => 'mino_theme_store_customizer', 'settings' => 'mino_store_support_customizer_set', 'type' => 'text' ) ); /* Store - Email */ $wp_customize->add_setting( 'mino_store_email_customizer_set' , array( 'default' => apply_filters( 'mino_set_default_store_email', '' ), 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_text' ), ) ); $wp_customize->add_control( 'mino_store_email_customizer_set', array( 'label' => __( 'Email', 'mino' ), 'section' => 'mino_theme_store_customizer', 'settings' => 'mino_store_email_customizer_set', 'type' => 'text' ) ); /* Store - Recent Post Label */ $wp_customize->add_setting( 'mino_store_recent_post_label_customizer_set' , array( 'default' => apply_filters( 'mino_set_default_store_recent_post_label', '' ), 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_text' ), ) ); $wp_customize->add_control( 'mino_store_recent_post_label_customizer_set', array( 'label' => __( 'Recent Post Label', 'mino' ), 'section' => 'mino_theme_store_customizer', 'settings' => 'mino_store_recent_post_label_customizer_set', 'type' => 'text' ) ); /* Store - Popular Category Label */ $wp_customize->add_setting( 'mino_store_popular_category_label_customizer_set' , array( 'default' => apply_filters( 'mino_set_default_store_popular_category_label', '' ), 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_text' ), ) ); $wp_customize->add_control( 'mino_store_popular_category_label_customizer_set', array( 'label' => __( 'Popular Category Label', 'mino' ), 'section' => 'mino_theme_store_customizer', 'settings' => 'mino_store_popular_category_label_customizer_set', 'type' => 'text' ) ); /* Store - Recent Product Label */ $wp_customize->add_setting( 'mino_store_recent_product_label_customizer_set' , array( 'default' => apply_filters( 'mino_set_default_store_recent_product_label', '' ), 'transport' => 'refresh', 'sanitize_callback' => array( $this, 'mino_sanitize_text' ), ) ); $wp_customize->add_control( 'mino_store_recent_product_label_customizer_set', array( 'label' => __( 'Recent Product Label', 'mino' ), 'section' => 'mino_theme_store_customizer', 'settings' => 'mino_store_recent_product_label_customizer_set', 'type' => 'text' ) ); } /* Sanitize */ function mino_sanitize_text( $text ) { return sanitize_text_field( $text ); } function mino_sanitize_theme_color( $color ) { $color_choice = apply_filters( 'mino_color_theme_choice', array( 'black', 'orange', 'red', 'green', 'blue' ) ); if ( ! in_array( $color, $color_choice ) ) { $color = apply_filters( 'mino_set_default_theme_color', 'black' ); } return $color; } function mino_sanitize_theme_layout( $layout ) { $layout_choice = apply_filters( 'mino_layout_theme_choice', array( 'wide', 'boxed' ) ); if ( ! in_array( $layout, $layout_choice ) ) { $layout = apply_filters( 'mino_set_default_layout', 'wide' ); } return $layout; } function mino_sanitize_theme_layoutbar( $layout ) { $layout_choice = apply_filters( 'mino_layoutbar_theme_choice', array( 'full', 'left', 'right' ) ); if ( ! in_array( $layout, $layout_choice ) ) { $layout = apply_filters( 'mino_set_default_layoutbar', 'full' ); } return $layout; } function mino_sanitize_breadcrumb( $types ) { $multi_values = ( (array) $types != $types ) ? explode( ',', $types ) : $types; return ! empty( $multi_values ) ? array_map( 'sanitize_text_field', $multi_values ) : array(); } function mino_sanitize_bool_options( $bool ) { if ( ! in_array( $bool, array( 0, 1 ) ) ) { $bool = 1; } return $bool; } } new Mino_Customizer();