get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->get_section( 'static_front_page' )->panel = 'homepage_option_panel'; $wp_customize->get_section( 'static_front_page' )->title = esc_html__('Homepage Page/Post Option','always'); $wp_customize->get_section( 'colors' )->panel = 'theme_colors_panel'; $wp_customize->get_section( 'colors' )->title = esc_html__('Color Options','always'); $wp_customize->get_section( 'title_tagline' )->panel = 'theme_general_settings'; $wp_customize->get_section( 'background_image' )->panel = 'theme_general_settings'; if ( isset( $wp_customize->selective_refresh ) ) { $wp_customize->selective_refresh->add_partial( 'blogname', array( 'selector' => '.site-title a', 'render_callback' => 'always_customize_partial_blogname', ) ); $wp_customize->selective_refresh->add_partial( 'blogdescription', array( 'selector' => '.site-description', 'render_callback' => 'always_customize_partial_blogdescription', ) ); } $wp_customize->add_setting('logo_width_range', array( 'default' => $always_default['logo_width_range'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'always_sanitize_number_range', ) ); $wp_customize->add_control('logo_width_range', array( 'label' => esc_html__('Logo With', 'always'), 'description' => esc_html__( 'Define logo size min-200 to max-700 (step-20)', 'always' ), 'section' => 'title_tagline', 'type' => 'range', 'input_attrs' => array( 'min' => 200, 'max' => 700, 'step' => 20, ), ) ); $wp_customize->add_setting('ed_header_bar_date', array( 'default' => $always_default['ed_header_bar_date'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'always_sanitize_checkbox', ) ); $wp_customize->add_control('ed_header_bar_date', array( 'label' => esc_html__('Enable Current Date', 'always'), 'section' => 'title_tagline', 'type' => 'checkbox', ) ); $wp_customize->add_setting( 'header_date_format', array( 'default' => $always_default['header_date_format'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'header_date_format', array( 'label' => esc_html__( 'Breaking Date Format', 'always' ), 'section' => 'title_tagline', 'type' => 'text', ) ); $wp_customize->add_setting('ed_header_bar_clock', array( 'default' => $always_default['ed_header_bar_clock'], 'capability' => 'edit_theme_options', 'sanitize_callback' => 'always_sanitize_checkbox', ) ); $wp_customize->add_control('ed_header_bar_clock', array( 'label' => esc_html__('Enable Clock', 'always'), 'section' => 'title_tagline', 'type' => 'checkbox', ) ); // Homepage Options Panel. $wp_customize->add_panel( 'homepage_option_panel', array( 'title' => esc_html__( 'HomePage Options', 'always' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); // Theme Options Panel. $wp_customize->add_panel( 'theme_option_panel', array( 'title' => esc_html__( 'Theme Options', 'always' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_panel( 'theme_general_settings', array( 'title' => esc_html__( 'General Settings', 'always' ), 'priority' => 10, 'capability' => 'edit_theme_options', ) ); $wp_customize->add_panel( 'theme_colors_panel', array( 'title' => esc_html__( 'Color Settings', 'always' ), 'priority' => 15, 'capability' => 'edit_theme_options', ) ); // Theme Options Panel. $wp_customize->add_panel( 'theme_footer_option_panel', array( 'title' => esc_html__( 'Footer Setting', 'always' ), 'priority' => 150, 'capability' => 'edit_theme_options', ) ); $always_defaults = always_get_default_theme_options(); $home_section_arrange_vals_3 = get_theme_mod( 'home_section_arrange_vals_3', $always_defaults['home_section_arrange_vals_3'] ); $home_section_arrange_vals_3 = explode(",",$home_section_arrange_vals_3 ); $j = 1; foreach( $home_section_arrange_vals_3 as $home_section_arrange ){ if ($j <= 5) { $wp_customize->get_section( $home_section_arrange )->priority = $j; } $j ++; } // Register custom section types. $wp_customize->register_section_type( 'Always_Customize_Section_Upsell' ); // Register sections. $wp_customize->add_section( new Always_Customize_Section_Upsell( $wp_customize, 'theme_upsell', array( 'title' => esc_html__( 'Always Pro', 'always' ), 'pro_text' => esc_html__( 'Purchase', 'always' ), 'pro_url' => esc_url('https://www.themeinwp.com/theme/always-pro/'), 'priority' => 1, ) ) ); } endif; add_action( 'customize_register', 'always_customize_register' ); add_action( 'wp_ajax_always_arrange_home_section', 'always_arrange_home_section' ); add_action('wp_ajax_nopriv_always_arrange_home_section', 'always_arrange_home_section'); function always_arrange_home_section() { if ( isset( $_POST['sections'] ) ) { set_theme_mod( 'home_section_arrange_vals_3', wp_unslash( $_POST['sections'] ) ); } wp_die(); // this is required to terminate immediately and return a proper response } /** * Customizer Enqueue scripts and styles. */ if (!function_exists('always_customizer_scripts')) : function always_customizer_scripts(){ wp_enqueue_script('jquery-ui-button'); wp_enqueue_style('always-repeater', get_template_directory_uri() . '/assets/lib/custom/css/repeater.css'); wp_enqueue_style('always-customizer', get_template_directory_uri() . '/assets/lib/custom/css/customizer.css'); wp_enqueue_script('always-customizer', get_template_directory_uri() . '/assets/lib/custom/js/customizer.js', array('jquery','customize-controls'), '', 1); wp_enqueue_script('always-repeater', get_template_directory_uri() . '/assets/lib/custom/js/repeater.js', array('jquery','customize-controls'), '', 1); wp_enqueue_script('always-re-customizer', get_template_directory_uri() . '/assets/lib/custom/js/re-customizer.js', array('jquery','customize-controls'), '', 1); $always_post_category_list = always_post_category_list(); $cat_option = ''; if( $always_post_category_list ){ foreach( $always_post_category_list as $key => $cats ){ $cat_option .= ""; } } wp_localize_script( 'always-repeater', 'always_repeater', array( 'categories' => $cat_option, 'upload_image' => esc_html__('Choose Image','always'), 'use_image' => esc_html__('Select','always'), ) ); $ajax_nonce = wp_create_nonce('always_ajax_nonce'); wp_localize_script( 'always-customizer', 'always_customizer', array( 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 'ajax_nonce' => $ajax_nonce, ) ); $home_section_arrange_vals_3 = get_theme_mod( 'home_section_arrange_vals_3' ); $home_section_arrange_vals_3 = explode(",",$home_section_arrange_vals_3 ); $key_sidebar = ''; $home_url = esc_url( home_url('/') ); wp_localize_script( 'always-re-customizer', 'always_re_customizer', array( 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), 'ajax_nonce' => $ajax_nonce, 'key_sidebar' => $key_sidebar, 'home_url' => $home_url, ) ); } endif; add_action('customize_controls_enqueue_scripts', 'always_customizer_scripts'); add_action('customize_controls_init', 'always_customizer_scripts'); /** * Render the site title for the selective refresh partial. * * @return void */ if (!function_exists('always_customize_partial_blogname')) : function always_customize_partial_blogname() { bloginfo( 'name' ); } endif; /** * Render the site tagline for the selective refresh partial. * * @return void */ if (!function_exists('always_customize_partial_blogdescription')) : function always_customize_partial_blogdescription() { bloginfo( 'description' ); } endif; add_action('wp_ajax_always_customizer_font_weight', 'always_customizer_font_weight_callback'); add_action('wp_ajax_nopriv_always_customizer_font_weight', 'always_customizer_font_weight_callback'); // Recommendec Post Ajax Call Function. function always_customizer_font_weight_callback() { if ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_POST['_wpnonce'] ), 'always_ajax_nonce' ) && isset( $_POST['currentfont'] ) && sanitize_text_field( wp_unslash( $_POST['currentfont'] ) ) ) { $currentfont = sanitize_text_field( wp_unslash( $_POST['currentfont'] ) ); $headings_fonts_property = Always_Fonts::always_get_fonts_property( $currentfont ); foreach( $headings_fonts_property['weight'] as $key => $value ){ echo ''; } } wp_die(); }