get_section( 'colors' )->description = __( 'Background may only be visible on wide screens.', 'shopera' ); $wp_customize->get_section( 'background_image' )->description = __( 'Background may only be visible on wide screens.', 'shopera' ); // Add postMessage support for site title and description. $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; // Rename the label to "Site Title Color" because this only affects the site title in this theme. $wp_customize->get_control( 'header_textcolor' )->label = __( 'Site Title Color', 'shopera' ); // Rename the label to "Display Site Title & Tagline" in order to make this option extra clear. $wp_customize->get_control( 'display_header_text' )->label = __( 'Display Site Title & Tagline', 'shopera' ); // Add the featured content section in case it's not already there. $wp_customize->add_section( 'featured_content', array( 'title' => __( 'Featured Content', 'shopera' ), 'description' => sprintf( __( 'To feature your posts use featured tag or provide your own tag below. If no posts match the tag, sticky posts will be displayed instead.', 'shopera' ), admin_url( '/edit.php?tag=featured' ), admin_url( '/edit.php?show_sticky=1' ) ), 'priority' => 130, ) ); $wp_customize->add_section( 'featured_content_side', array( 'title' => __( 'Featured Side Content', 'shopera' ), 'description' => sprintf( __( 'To feature your posts use featured-side tag or provide your own tag below. If no posts match the tag, sticky posts will be displayed instead.', 'shopera' ), admin_url( '/edit.php?tag=featured-side' ), admin_url( '/edit.php?show_sticky=1' ) ), 'priority' => 140, ) ); // Add General setting panel and configure settings inside it $wp_customize->add_panel( 'shopera_general_panel', array( 'priority' => 150, 'capability' => 'edit_theme_options', 'title' => __( 'General settings' , 'shopera'), 'description' => __( 'You can configure your general theme settings here' , 'shopera') ) ); // Website logo $wp_customize->add_section( 'shopera_general_logo', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'title' => __( 'Website logo' , 'shopera'), 'description' => __( 'Please upload your logo, recommended logo size should be between 262x80' , 'shopera'), 'panel' => 'shopera_general_panel' ) ); $wp_customize->add_setting( 'shopera_logo', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'shopera_logo', array( 'label' => __( 'Website logo', 'shopera' ), 'section' => 'shopera_general_logo', 'settings' => 'shopera_logo', ) ) ); // woocommerce shop breadcrumb $wp_customize->add_section( 'shopera_general_shop_breadcrumb', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'title' => __( 'WooCommerce shop breadcrumb' , 'shopera'), 'description' => __( 'Please upload your image for WooCommerce shop breadcrumbs.' , 'shopera'), 'panel' => 'shopera_general_panel' ) ); $wp_customize->add_setting( 'shopera_shop_breadcrumbs', array( 'default' => get_template_directory_uri().'/images/breadcrumbs.jpg', 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'shopera_shop_breadcrumbs', array( 'label' => __( 'WooCommerce shop breadcrumb', 'shopera' ), 'section' => 'shopera_general_shop_breadcrumb', 'settings' => 'shopera_shop_breadcrumbs', ) ) ); // Copyright $wp_customize->add_section( 'shopera_general_copyright', array( 'priority' => 20, 'capability' => 'edit_theme_options', 'title' => __( 'Copyright' , 'shopera'), 'description' => __( 'Please provide short copyright text which will be shown in footer.' , 'shopera'), 'panel' => 'shopera_general_panel' ) ); $wp_customize->add_setting( 'shopera_copyright', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'shopera_copyright', array( 'label' => 'Copyright', 'section' => 'shopera_general_copyright', 'type' => 'text', ) ); // Scroll to top $wp_customize->add_section( 'shopera_general_scrolltotop', array( 'priority' => 30, 'capability' => 'edit_theme_options', 'title' => __( 'Scroll to top' , 'shopera'), 'description' => __( 'Do you want to enable "Scroll to Top" button?' , 'shopera'), 'panel' => 'shopera_general_panel' ) ); $wp_customize->add_setting( 'shopera_scrolltotop', array( 'sanitize_callback' => 'shopera_sanitize_checkbox' ) ); $wp_customize->add_control( 'shopera_scrolltotop', array( 'label' => 'Scroll to top', 'section' => 'shopera_general_scrolltotop', 'type' => 'checkbox', ) ); // Favicon $wp_customize->add_section( 'shopera_general_favicon', array( 'priority' => 40, 'capability' => 'edit_theme_options', 'title' => __( 'Favicon' , 'shopera'), 'description' => __( 'Do you have favicon? You can upload it here.' , 'shopera'), 'panel' => 'shopera_general_panel' ) ); $wp_customize->add_setting( 'shopera_favicon', array( 'sanitize_callback' => 'esc_url_raw' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'shopera_favicon', array( 'label' => __( 'Favicon', 'shopera' ), 'section' => 'shopera_general_favicon', 'settings' => 'shopera_favicon', ) ) ); // Comment form URL field $wp_customize->add_section( 'shopera_general_commenturl', array( 'priority' => 50, 'capability' => 'edit_theme_options', 'title' => __( 'Comment form URL field' , 'shopera'), 'description' => __( 'Do you want to disable comment URL field?' , 'shopera'), 'panel' => 'shopera_general_panel' ) ); $wp_customize->add_setting( 'shopera_commenturl', array( 'sanitize_callback' => 'shopera_sanitize_checkbox' ) ); $wp_customize->add_control( 'shopera_commenturl', array( 'label' => 'Comment form URL field', 'section' => 'shopera_general_commenturl', 'type' => 'checkbox', ) ); // Slider settings $wp_customize->add_section( 'shopera_general_slider', array( 'priority' => 51, 'capability' => 'edit_theme_options', 'title' => __( 'Slider status' , 'shopera'), 'description' => __( 'Enable or disable the front page slider.' , 'shopera'), 'panel' => 'shopera_general_panel' ) ); $wp_customize->add_setting( 'shopera_main_slider', array( 'default' => '1', 'sanitize_callback' => 'shopera_sanitize_checkbox' ) ); $wp_customize->add_control( 'shopera_main_slider', array( 'label' => 'Slider status', 'section' => 'shopera_general_slider', 'type' => 'checkbox', ) ); // Post grid settings $wp_customize->add_section( 'shopera_general_grid', array( 'priority' => 52, 'capability' => 'edit_theme_options', 'title' => __( 'Post grid status' , 'shopera'), 'description' => __( 'Do you want to display posts in a grid?' , 'shopera'), 'panel' => 'shopera_general_panel' ) ); $wp_customize->add_setting( 'shopera_post_grid', array( 'default' => '1', 'sanitize_callback' => 'shopera_sanitize_checkbox' ) ); $wp_customize->add_control( 'shopera_post_grid', array( 'label' => 'Post grid status', 'section' => 'shopera_general_grid', 'type' => 'checkbox', ) ); // Page layout $wp_customize->add_section( 'shopera_general_layout', array( 'priority' => 60, 'capability' => 'edit_theme_options', 'title' => __( 'Layout' , 'shopera'), 'description' => __( 'Choose a layout for your theme pages. Note that a widget has to be inside widget are, or the layout won\'t change.' , 'shopera'), 'panel' => 'shopera_general_panel' ) ); $wp_customize->add_setting( 'shopera_layout', array( 'default' => 'full', 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'shopera_layout', array( 'type' => 'radio', 'label' => 'Layout', 'section' => 'shopera_general_layout', 'choices' => array( 'left' => 'Left', 'full' => 'Full', 'right' => 'Right' ) ) ); // Add Font setting panel and configure settings inside it $wp_customize->add_panel( 'shopera_font_panel', array( 'priority' => 160, 'capability' => 'edit_theme_options', 'title' => __( 'Font settings' , 'shopera'), 'description' => __( 'You can configure your themes font settings here, if there are characters in your language that are not supported by a particular font, disable it..' , 'shopera') ) ); // Fonts $wp_customize->add_section( 'shopera_fonts', array( 'priority' => 10, 'capability' => 'edit_theme_options', 'title' => __( 'Theme fonts' , 'shopera'), 'description' => __( 'If there are characters in your language that are not supported by any of these fonts, disable them.' , 'shopera'), 'panel' => 'shopera_font_panel' ) ); $wp_customize->add_setting( 'shopera_roboto', array( 'default' => '1', 'sanitize_callback' => 'shopera_sanitize_checkbox' ) ); $wp_customize->add_control( 'shopera_roboto', array( 'label' => 'Roboto font', 'section' => 'shopera_fonts', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'shopera_roboto_slab', array( 'default' => '1', 'sanitize_callback' => 'shopera_sanitize_checkbox' ) ); $wp_customize->add_control( 'shopera_roboto_slab', array( 'label' => 'Roboto Slab font', 'section' => 'shopera_fonts', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'shopera_roboto_condensed', array( 'default' => '1', 'sanitize_callback' => 'shopera_sanitize_checkbox' ) ); $wp_customize->add_control( 'shopera_roboto_condensed', array( 'label' => 'Roboto font', 'section' => 'shopera_fonts', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'shopera_opensans', array( 'default' => '1', 'sanitize_callback' => 'shopera_sanitize_checkbox' ) ); $wp_customize->add_control( 'shopera_opensans', array( 'label' => 'Open Sans font', 'section' => 'shopera_fonts', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'shopera_satisfy', array( 'default' => '1', 'sanitize_callback' => 'shopera_sanitize_checkbox' ) ); $wp_customize->add_control( 'shopera_satisfy', array( 'label' => 'Satisfy font', 'section' => 'shopera_fonts', 'type' => 'checkbox', ) ); // Font size $wp_customize->add_section( 'shopera_font_size', array( 'priority' => 20, 'capability' => 'edit_theme_options', 'title' => __( 'Font size' , 'shopera'), 'description' => __( 'You can change your websites main title size.' , 'shopera'), 'panel' => 'shopera_font_panel' ) ); $wp_customize->add_setting( 'shopera_logo_font_size', array( 'default' => '50', 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'shopera_logo_font_size', array( 'label' => 'Satisfy font', 'section' => 'shopera_font_size', 'type' => 'range', 'input_attrs' => array( 'min' => 10, 'max' => 80, 'step' => 2, ) ) ); // Social links $wp_customize->add_section( new Shopera_Customized_Section( $wp_customize, 'shopera_social_links', array( 'priority' => 210, 'capability' => 'edit_theme_options' ) ) ); $wp_customize->add_setting( 'shopera_fake_field', array( 'sanitize_callback' => 'sanitize_text_field' ) ); $wp_customize->add_control( 'shopera_fake_field', array( 'label' => '', 'section' => 'shopera_social_links', 'type' => 'text' ) ); } add_action( 'customize_register', 'shopera_customize_register' ); if ( class_exists( 'WP_Customize_Section' ) && !class_exists( 'Shopera_Customized_Section' ) ) { class Shopera_Customized_Section extends WP_Customize_Section { public function render() { $classes = 'accordion-section control-section control-section-' . $this->type; ?>
  • add_help_tab( array( 'id' => 'shopera', 'title' => __( 'Shopera 1.0', 'shopera' ), 'content' => '', ) ); } add_action( 'admin_head-themes.php', 'shopera_contextual_help' ); add_action( 'admin_head-edit.php', 'shopera_contextual_help' );