get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'aspace_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'aspace_customize_partial_blogdescription', ) ); $wp_customize->add_section ( 'elv_easylogo_options', // $id array( // $args 'priority' => 10, 'title' => __( 'Logo design', 'aspace-free' ), 'description' => __( '', 'aspace-free' ), //'panel' => 'aspace_panel_basic' ) ); $wp_customize->add_section( 'theme_options', array( 'title' => esc_html__( 'Theme Options', 'aspace-free' ), 'priority' => 130, // Before Additional CSS. ) ); $wp_customize->add_section( 'footer_custom', array( 'title' => __( 'Footer', 'aspace-free' ), 'priority' => 105, // Before Widgets. ) ); $wp_customize->add_section( 'topbar_custom', array( 'title' => __( 'Topbar', 'aspace-free' ), 'priority' => 96, // Before Widgets. ) ); $wp_customize->add_setting ( 'section_logo_hidden', // $id array( // $args 'default' => true, 'type' => 'option', ) ); $wp_customize->add_setting ( 'site_wide_design', // $id array( // $args 'default' => 'container-fluid', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'aspace_sanitize_select', ) ); $wp_customize->add_setting ( 'footer_author_image', // $id array( // $args 'default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => '', ) ); $wp_customize->add_setting ( 'text_button_topbar', // $id array( // $args 'default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_filter_nohtml_kses', ) ); $wp_customize->add_setting ( 'text_engageuserfoo', // $id array( // $args 'default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_filter_nohtml_kses', ) ); $wp_customize->add_setting ( 'text_instagramfoo_button', // $id array( // $args 'default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_filter_nohtml_kses', ) ); $wp_customize->add_setting ( 'text_by_wordpress', // $id array( // $args 'default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_filter_nohtml_kses', ) ); $wp_customize->add_setting ( 'link_by_wordpress', // $id array( // $args 'default' => '', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_filter_nohtml_kses', ) ); $wp_customize->add_setting ( 'subscribe_form_text', // $id array( // $args 'default' => 'Subscribe NOW', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_filter_nohtml_kses', ) ); $wp_customize->add_setting ( 'subscribe_form_input', // $id array( // $args 'default' => 'Enter your E-mail', 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'wp_filter_nohtml_kses', ) ); $wp_customize->add_control ( 'section_logo_hidden', // $id array( // $args 'settings' => 'section_logo_hidden', 'section' => 'elv_easylogo_options', 'type' => 'switch', 'label' => __( 'Show logo design ON or OFF', 'aspace-free' ), 'default' => true, ) ); $wp_customize->add_control ( 'site_wide_design', // $id array( // $args 'settings' => 'site_wide_design', 'section' => 'aspace_section_basic', 'type' => 'select', 'label' => __( 'Design Layout', 'aspace-free' ), 'description' => __( 'Choose a default page layout for your pages: Fullwidth or Boxed.', 'aspace-free' ), 'choices' => array( 'container-fluid' => __( 'Full width (default)', 'aspace-free' ), 'container' => __( 'Boxed', 'aspace-free' ), ) ) ); $wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, 'footer_author_image', array( 'label' => __( 'Footer author Image', 'aspace-free' ), 'settings' => 'footer_author_image', 'section' => 'footer_custom', 'mime_type' => 'image', ) ) ); $wp_customize->add_control( 'text_button_topbar', // $id array( 'label' => __( 'Topbar text button', 'aspace-free' ), 'settings' => 'text_button_topbar', 'section' => 'topbar_custom', 'type' => 'text', ) ); $wp_customize->add_control( 'text_engageuserfoo', // $id array( 'label' => __( 'Text engage users', 'aspace-free' ), 'settings' => 'text_engageuserfoo', 'section' => 'footer_custom', 'type' => 'text', ) ); $wp_customize->add_control( 'text_instagramfoo_button', // $id array( 'label' => __( 'Text footer follow instagram', 'aspace-free' ), 'settings' => 'text_instagramfoo_button', 'section' => 'footer_custom', 'type' => 'text', ) ); $wp_customize->add_control( 'text_by_wordpress', // $id array( 'label' => __( 'Proudly powered by WordPress Text', 'aspace-free' ), 'settings' => 'text_by_wordpress', 'section' => 'footer_custom', 'type' => 'textarea', ) ); $wp_customize->add_control( 'link_by_wordpress', // $id array( 'label' => __( 'Link of the copyright footer text', 'aspace-free' ), 'settings' => 'link_by_wordpress', 'section' => 'footer_custom', 'type' => 'textarea', ) ); $wp_customize->add_control( 'subscribe_form_text', // $id array( 'label' => __( 'SUBSCRIB NOW', 'aspace-free' ), 'settings' => 'subscribe_form_text', 'section' => 'footer_custom', 'type' => 'texT', ) ); $wp_customize->add_control( 'subscribe_form_input', // $id array( 'label' => __( 'Enter your E-mail', 'aspace-free' ), 'settings' => 'subscribe_form_input', 'section' => 'footer_custom', 'type' => 'texT', ) ); } add_action( 'customize_register', 'aspace_customize_register' ); add_action('customize_save', 'add_aspace_design', 100); function add_aspace_design(){ if(is_customize_preview()){ $aspacepress_post_types = get_post_types( array('_builtin' => false, 'has_archive' => true), 'objects' ); $aspacepress_post_types[] = get_post_type_object( 'post' ); foreach ($aspacepress_post_types as $post_type) { $archive_theme_mod = get_theme_mod('ign_archive_' . $post_type->name); if($archive_theme_mod){ delete_post_meta($archive_theme_mod, '_ign_archive_page'); } } } } add_action('customize_save_after', 'save_aspace_design', 100); function save_aspace_design(){ if(is_customize_preview()){ $aspacepress_post_types = get_post_types( array('_builtin' => false, 'has_archive' => true), 'objects' ); $aspacepress_post_types[] = get_post_type_object( 'post' ); foreach ($aspacepress_post_types as $post_type) { $archive_theme_mod = get_theme_mod('ign_archive_' . $post_type->name); if($archive_theme_mod){ update_post_meta($archive_theme_mod, '_ign_archive_page', $post_type->name); } } } } function aspace_customize_partial_blogname() { bloginfo( 'name' ); } function aspace_customize_partial_blogdescription() { bloginfo( 'description' ); } function aspace_sanitize_file( $file, $setting ) { $mimes = array( 'jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png' ); $file_ext = wp_check_filetype( $file, $mimes ); return ( $file_ext['ext'] ? $file : $setting->default ); } function aspace_sanitize_select( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } function aspace_sanitize_widget_area( $value ) { if ( !in_array( $value, array( 'enable', 'disable' ) ) ) { $value = 'disable'; } return $value; } function aspace_sanitize_checkbox( $checked ) { return ( ( isset( $checked ) && true == $checked ) ? true : false ); } function aspace_sanitize_html( $html ) { return wp_filter_post_kses( $html ); } function aspace_sanitize_url( $url ) { return esc_url_raw( $url ); } function aspace_panels_js() { wp_enqueue_script( 'aspace-customize-controls', get_theme_file_uri( '/assets/js/customize-controls.js' ), array(), '1.0', true ); }