PATH:
home
/
centosnipponia
/
public_html
/
sweetrich
/
wp-content
/
themes
/
sydney-pro-ii
/
inc
/
customizer
<?php /** * Sydney Theme Customizer * * @package Sydney */ function sydney_customize_register( $wp_customize ) { $wp_customize->remove_control( 'header_textcolor' ); $wp_customize->remove_control( 'display_header_text' ); $wp_customize->get_section( 'header_image' )->panel = 'sydney_panel_hero'; $wp_customize->get_section( 'header_image' )->priority = 99; $wp_customize->get_section( 'title_tagline' )->priority = 9; if ( get_option( 'sydney-update-header' ) ) { $wp_customize->get_section( 'title_tagline' )->panel = 'sydney_panel_header'; } //Partials for ($i = 1; $i < 5; $i++) { $wp_customize->selective_refresh->add_partial( 'slider_title_' . $i, array( 'selector' => '.slide-item-' . $i . ' .maintitle', 'render_callback' => 'sydney_partial_slider_title_' . $i, ) ); $wp_customize->selective_refresh->add_partial( 'slider_subtitle_' . $i, array( 'selector' => '.slide-item-' . $i . ' .subtitle', 'render_callback' => 'sydney_partial_slider_subtitle_' . $i, ) ); } $wp_customize->selective_refresh->add_partial( 'slider_button_text', array( 'selector' => '.button-slider', 'render_callback' => 'sydney_partial_slider_button_text', ) ); //Divider class Sydney_Divider extends WP_Customize_Control { public function render_content() { echo '<hr style="margin: 15px 0;" />'; } } //Titles class Sydney_Info extends WP_Customize_Control { public $type = 'info'; public $label = ''; public function render_content() { ?> <h3 style="margin-top:30px;padding:12px;color:#000;background:#cbcbcb;text-align:center;text-transform:uppercase;"><?php echo esc_html( $this->label ); ?></h3> <p><?php echo esc_html( $this->description ); ?></p> <?php } } /** * Callbacks and sanitize */ require get_template_directory() . '/inc/customizer/callbacks.php'; require get_template_directory() . '/inc/customizer/sanitize.php'; /** * Controls */ require get_template_directory() . '/inc/customizer/controls/typography/class_sydney_typography.php'; require get_template_directory() . '/inc/customizer/controls/repeater/class_sydney_repeater.php'; require get_template_directory() . '/inc/customizer/controls/alpha-color/class_sydney_alpha_color.php'; require get_template_directory() . '/inc/customizer/controls/radio-images/class_sydney_radio_images.php'; require get_template_directory() . '/inc/customizer/controls/radio-buttons/class_sydney_radio_buttons.php'; require get_template_directory() . '/inc/customizer/controls/responsive-slider/class_sydney_responsive_slider.php'; require get_template_directory() . '/inc/customizer/controls/class_sydney_tab_control.php'; require get_template_directory() . '/inc/customizer/controls/class_sydney_text_control.php'; require get_template_directory() . '/inc/customizer/controls/class_sydney_posts_control.php'; //require get_template_directory() . '/inc/customizer/controls/class_sydney_tinymce_control.php'; require get_template_directory() . '/inc/customizer/controls/class_sydney_divider_control.php'; require get_template_directory() . '/inc/customizer/controls/toggle/class_sydney_toggle_control.php'; //require get_template_directory() . '/inc/customizer/controls/color-palettes/class_sydney_color_palettes_control.php'; //require get_template_directory() . '/inc/customizer/controls/color-palettes/class_sydney_custom_palettes_control.php'; require get_template_directory() . '/inc/customizer/controls/accordion/class_sydney_accordion_control.php'; require get_template_directory() . '/inc/customizer/controls/control-checkbox-multiple.php'; require get_template_directory() . '/inc/customizer/controls/multiple-select/class-control-multiple-select.php'; $wp_customize->register_control_type( 'Sydney_Select2_Custom_Control' ); $wp_customize->register_control_type( '\Kirki\Control\sortable' ); require get_template_directory() . '/inc/customizer/controls/class_sydney_create_page_control.php'; require get_template_directory() . '/inc/customizer/controls/display-conditions/class_sydney_display_conditions_control.php'; require get_template_directory() . '/inc/customizer/controls/custom-sidebars/class_sydney_custom_sidebars_control.php'; require get_template_directory() . '/inc/customizer/controls/typography-adobe/class_sydney_typography_adobe.php'; require get_template_directory() . '/inc/customizer/controls/typography-adobe/class_sydney_typography_adobe_kits.php'; require get_template_directory() . '/inc/customizer/controls/class_sydney_tinymce_control.php'; /** * Options */ require get_template_directory() . '/inc/customizer/options/general.php'; if ( get_option( 'sydney-update-header' ) ) { require get_template_directory() . '/inc/customizer/options/topbar.php'; require get_template_directory() . '/inc/customizer/options/header.php'; require get_template_directory() . '/inc/customizer/options/header-mobile.php'; } require get_template_directory() . '/inc/customizer/options/typography.php'; require get_template_directory() . '/inc/customizer/options/footer.php'; require get_template_directory() . '/inc/customizer/options/blog.php'; require get_template_directory() . '/inc/customizer/options/blog-single.php'; require get_template_directory() . '/inc/customizer/options/colors.php'; require get_template_directory() . '/inc/customizer/options/performance.php'; require get_template_directory() . '/inc/customizer/options/cpt-panels.php'; require get_template_directory() . '/inc/customizer/options/layouts.php'; if ( class_exists( 'Woocommerce' ) ) { require get_template_directory() . '/inc/customizer/options/woocommerce.php'; require get_template_directory() . '/inc/customizer/options/woocommerce-single.php'; } //___Hero slider___// require get_template_directory() . '/inc/customizer/options/hero-area.php'; if ( !get_option( 'sydney-update-header' ) ) { //___Menu style___// $wp_customize->add_section( 'sydney_menu_style', array( 'title' => __('Menu layout', 'sydney'), 'priority' => 15, 'panel' => 'sydney_panel_hero', ) ); //Sticky menu $wp_customize->add_setting( 'sticky_menu', array( 'default' => 'sticky', 'sanitize_callback' => 'sydney_sanitize_sticky', ) ); $wp_customize->add_control( 'sticky_menu', array( 'type' => 'select', 'priority' => 10, 'label' => __('Sticky menu', 'sydney'), 'section' => 'sydney_menu_style', 'choices' => array( 'sticky' => __('Sticky', 'sydney'), 'static' => __('Static', 'sydney'), ), ) ); //Menu style $wp_customize->add_setting( 'menu_style', array( 'default' => 'inline', 'sanitize_callback' => 'sydney_sanitize_menu_style', ) ); $wp_customize->add_control( 'menu_style', array( 'type' => 'select', 'priority' => 11, 'label' => __('Menu style', 'sydney'), 'section' => 'sydney_menu_style', 'choices' => array( 'inline' => __('Inline', 'sydney'), 'centered' => __('Centered (menu and site logo)', 'sydney'), ), ) ); //Menu style $wp_customize->add_setting( 'menu_container', array( 'default' => 'container', 'sanitize_callback' => 'sydney_sanitize_menu_container', ) ); $wp_customize->add_control( 'menu_container', array( 'type' => 'select', 'priority' => 11, 'label' => __('Menu container', 'sydney'), 'section' => 'sydney_menu_style', 'choices' => array( 'container' => __('Contained', 'sydney'), 'fw-menu-container' => __('Full width', 'sydney'), ), ) ); //Custom menu item $wp_customize->add_setting( 'header_button_html', array( 'default' => 'nothing', 'sanitize_callback' => 'sydney_sanitize_header_custom_item', ) ); $wp_customize->add_control( 'header_button_html', array( 'type' => 'select', 'priority' => 11, 'label' => __('Header custom item', 'sydney'), 'section' => 'sydney_menu_style', 'choices' => array( 'nothing' => __( 'Nothing', 'sydney' ), 'button' => __( 'Button', 'sydney' ), 'html' => __( 'HTML', 'sydney' ), ), ) ); $wp_customize->add_setting('sydney_options[info]', array( 'type' => 'info_control', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new Sydney_Divider( $wp_customize, 'hcs_sep', array( 'section' => 'sydney_menu_style', 'settings' => 'sydney_options[info]', 'priority' => 11, 'active_callback' => 'sydney_header_custom_btn_active_callback' ) ) ); $wp_customize->add_setting( 'header_custom_item_btn_link', array( 'default' => 'https://example.org/', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( 'header_custom_item_btn_link', array( 'label' => __( 'Button link', 'sydney' ), 'section' => 'sydney_menu_style', 'type' => 'text', 'priority' => 11, 'active_callback' => 'sydney_header_custom_btn_active_callback' ) ); $wp_customize->add_setting( 'header_custom_item_btn_text', array( 'default' => __( 'Get in touch', 'sydney' ), 'sanitize_callback' => 'sydney_sanitize_text', ) ); $wp_customize->add_control( 'header_custom_item_btn_text', array( 'label' => __( 'Button text', 'sydney' ), 'section' => 'sydney_menu_style', 'type' => 'text', 'priority' => 11, 'active_callback' => 'sydney_header_custom_btn_active_callback' ) ); $wp_customize->add_setting( 'header_custom_item_btn_target', array( 'default' => 1, 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'header_custom_item_btn_target', array( 'type' => 'checkbox', 'label' => __('Open link in a new tab?', 'sydney'), 'section' => 'sydney_menu_style', 'priority' => 11, 'active_callback' => 'sydney_header_custom_btn_active_callback' ) ); $wp_customize->add_setting( 'header_custom_item_btn_tb_padding', array( 'sanitize_callback' => 'absint', 'default' => '12', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'header_custom_item_btn_tb_padding', array( 'type' => 'number', 'priority' => 11, 'section' => 'sydney_menu_style', 'label' => __('Top/bottom button padding', 'sydney'), 'input_attrs' => array( 'min' => 0, 'max' => 40, 'step' => 1, ), 'active_callback' => 'sydney_header_custom_btn_active_callback' ) ); $wp_customize->add_setting( 'header_custom_item_btn_lr_padding', array( 'sanitize_callback' => 'absint', 'default' => '35', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'header_custom_item_btn_lr_padding', array( 'type' => 'number', 'priority' => 11, 'section' => 'sydney_menu_style', 'label' => __('Left/right button padding', 'sydney'), 'input_attrs' => array( 'min' => 0, 'max' => 50, 'step' => 1, ), 'active_callback' => 'sydney_header_custom_btn_active_callback' ) ); //Font size $wp_customize->add_setting( 'header_custom_item_btn_font_size', array( 'sanitize_callback' => 'absint', 'default' => '13', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'header_custom_item_btn_font_size', array( 'type' => 'number', 'priority' => 11, 'section' => 'sydney_menu_style', 'label' => __('Button font size', 'sydney'), 'input_attrs' => array( 'min' => 10, 'max' => 40, 'step' => 1, ), 'active_callback' => 'sydney_header_custom_btn_active_callback' ) ); //Border radius $wp_customize->add_setting( 'header_custom_item_btn_radius', array( 'sanitize_callback' => 'absint', 'default' => '3', 'transport' => 'postMessage' ) ); $wp_customize->add_control( 'header_custom_item_btn_radius', array( 'type' => 'number', 'priority' => 11, 'section' => 'sydney_menu_style', 'label' => __('Button border radius', 'sydney'), 'input_attrs' => array( 'min' => 0, 'max' => 50, 'step' => 1, ), 'active_callback' => 'sydney_header_custom_btn_active_callback' ) ); //Custom header html $wp_customize->add_setting('sydney_options[info]', array( 'type' => 'info_control', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new Sydney_Divider( $wp_customize, 'hcs_html_sep', array( 'section' => 'sydney_menu_style', 'settings' => 'sydney_options[info]', 'priority' => 11, 'active_callback' => 'sydney_header_custom_html_active_callback' ) ) ); $wp_customize->add_setting( 'header_custom_item_html', array( 'sanitize_callback' => 'sydney_sanitize_text', 'default' => '<a href="#">Your content</a>', ) ); $wp_customize->add_control( 'header_custom_item_html', array( 'type' => 'textarea', 'priority' => 11, 'section' => 'sydney_menu_style', 'label' => __('Custom HTML', 'sydney'), 'active_callback' => 'sydney_header_custom_html_active_callback' ) ); } //Header image size $wp_customize->add_setting( 'header_bg_size', array( 'default' => 'cover', 'sanitize_callback' => 'sydney_sanitize_bg_size', ) ); $wp_customize->add_control( 'header_bg_size', array( 'type' => 'radio', 'priority' => 10, 'label' => __('Header background size', 'sydney'), 'section' => 'header_image', 'choices' => array( 'cover' => __('Cover', 'sydney'), 'contain' => __('Contain', 'sydney'), ), ) ); //Header height $wp_customize->add_setting( 'header_height', array( 'sanitize_callback' => 'absint', 'default' => '300', ) ); $wp_customize->add_control( 'header_height', array( 'type' => 'number', 'priority' => 11, 'section' => 'header_image', 'label' => __('Header height [default: 300px]', 'sydney'), 'input_attrs' => array( 'min' => 250, 'max' => 600, 'step' => 5, ), ) ); //Disable overlay $wp_customize->add_setting( 'hide_overlay', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'hide_overlay', array( 'type' => 'checkbox', 'label' => __('Disable the overlay?', 'sydney'), 'section' => 'header_image', 'priority' => 12, ) ); //Logo Upload $wp_customize->add_setting( 'site_logo', array( 'default-image' => '', 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'site_logo', array( 'label' => __( 'Upload your logo', 'sydney' ), 'type' => 'image', 'section' => 'title_tagline', 'priority' => 12, ) ) ); //___Pro options___// $wp_customize->add_panel( 'sydney_pro_panel', array( 'priority' => 20, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'title' => __('Extra options', 'sydney'), ) ); if ( defined( 'SITEORIGIN_PANELS_VERSION' ) ) { //___Front page section titles___// $wp_customize->add_section( 'sydney_fp_titles', array( 'title' => __('Front page section titles', 'sydney'), 'priority' => 11, 'panel' => 'sydney_pro_panel', ) ); //Margin $wp_customize->add_setting( 'section_title_margin', array( 'sanitize_callback' => 'absint', 'default' => '60', ) ); $wp_customize->add_control( 'section_title_margin', array( 'type' => 'number', 'priority' => 10, 'section' => 'sydney_fp_titles', 'label' => __('Title bottom margin', 'sydney'), 'input_attrs' => array( 'min' => 0, 'max' => 150, 'step' => 5, ), ) ); //Transform $wp_customize->add_setting( 'section_title_transform', array( 'default' => 'none', 'sanitize_callback' => 'sydney_sanitize_transform', ) ); $wp_customize->add_control( 'section_title_transform', array( 'type' => 'radio', 'label' => __('Title text transform', 'sydney'), 'section' => 'sydney_fp_titles', 'priority' => 11, 'choices' => array( 'uppercase'=> __('Uppercase', 'sydney'), 'none' => __('None', 'sydney'), ), ) ); //Italicize $wp_customize->add_setting( 'section_title_italicize', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'section_title_italicize', array( 'type' => 'checkbox', 'label' => __('Italicize titles?', 'sydney'), 'section' => 'sydney_fp_titles', 'priority' => 12, ) ); //Align $wp_customize->add_setting( 'section_title_style', array( 'default' => 'default', 'sanitize_callback' => 'sydney_sanitize_tstyle', ) ); $wp_customize->add_control( 'section_title_style', array( 'type' => 'radio', 'label' => __('Title style', 'sydney'), 'section' => 'sydney_fp_titles', 'priority' => 13, 'choices' => array( 'default' => __('Default', 'sydney'), 'bordered' => __('Bordered', 'sydney'), 'solid' => __('Solid', 'sydney'), ), ) ); //___Single employees___// $wp_customize->add_section( 'sydney_single_employees', array( 'title' => __('Single employees', 'sydney'), 'priority' => 12, 'panel' => 'sydney_pro_panel', ) ); //Full width singles $wp_customize->add_setting( 'fullwidth_employee', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'fullwidth_employee', array( 'type' => 'checkbox', 'label' => __('Full width single employees?', 'sydney'), 'section' => 'sydney_single_employees', 'priority' => 10, ) ); //Emp images $wp_customize->add_setting( 'employee_feat_image', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'employee_feat_image', array( 'type' => 'checkbox', 'label' => __('Check this box to hide featured images on single employees', 'sydney'), 'section' => 'sydney_single_employees', 'priority' => 11, ) ); //Employee single nav $wp_customize->add_setting( 'employee_nav', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'employee_nav', array( 'type' => 'checkbox', 'label' => __('Check this box to hide the employee navigation', 'sydney'), 'section' => 'sydney_single_employees', 'priority' => 12, ) ); //___Single projects___// $wp_customize->add_section( 'sydney_single_projects', array( 'title' => __('Single projects', 'sydney'), 'priority' => 13, 'panel' => 'sydney_pro_panel', ) ); //Full width singles $wp_customize->add_setting( 'fullwidth_project', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'fullwidth_project', array( 'type' => 'checkbox', 'label' => __('Full width single projects?', 'sydney'), 'section' => 'sydney_single_projects', 'priority' => 10, ) ); //Project images $wp_customize->add_setting( 'project_feat_image', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'project_feat_image', array( 'type' => 'checkbox', 'label' => __('Display the project featured image as header image?', 'sydney'), 'section' => 'sydney_single_projects', 'priority' => 11, ) ); //Project single nav $wp_customize->add_setting( 'project_nav', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'project_nav', array( 'type' => 'checkbox', 'label' => __('Check this box to hide the projects navigation', 'sydney'), 'section' => 'sydney_single_projects', 'priority' => 12, ) ); } //end SITEORIGIN_PANELS_VERSION check if ( !get_option( 'sydney-update-header' ) ) { //___Top contact info___// $wp_customize->add_section( 'sydney_contact_info', array( 'title' => __('Header contact info', 'sydney'), 'priority' => 14, 'panel' => 'sydney_pro_panel', ) ); //Activate contact $wp_customize->add_setting( 'toggle_contact', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'toggle_contact', array( 'type' => 'checkbox', 'label' => __('Activate the header contact info?', 'sydney'), 'section' => 'sydney_contact_info', 'priority' => 10, ) ); //Phone $wp_customize->add_setting( 'contact_phone', array( 'default' => '99.123.456', 'sanitize_callback' => 'sydney_sanitize_text', ) ); $wp_customize->add_control( 'contact_phone', array( 'label' => __( 'Phone number', 'sydney' ), 'section' => 'sydney_contact_info', 'type' => 'text', 'priority' => 11 ) ); //Email $wp_customize->add_setting( 'contact_email', array( 'default' => 'office@site.com', 'sanitize_callback' => 'sydney_sanitize_text', ) ); $wp_customize->add_control( 'contact_email', array( 'label' => __( 'Email address', 'sydney' ), 'section' => 'sydney_contact_info', 'type' => 'text', 'priority' => 12 ) ); //Address $wp_customize->add_setting( 'contact_address', array( 'default' => '12 Street, New York City', 'sanitize_callback' => 'sydney_sanitize_text', ) ); $wp_customize->add_control( 'contact_address', array( 'label' => __( 'Address', 'sydney' ), 'section' => 'sydney_contact_info', 'type' => 'text', 'priority' => 13 ) ); //Contact center $wp_customize->add_setting( 'contact_center', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'contact_center', array( 'type' => 'checkbox', 'label' => __('Center the contact info?', 'sydney'), 'section' => 'sydney_contact_info', 'priority' => 14, ) ); //Contact background $wp_customize->add_setting( 'contact_background', array( 'default' => '#1c1c1c', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'contact_background', array( 'label' => __('Contact background', 'sydney'), 'section' => 'sydney_contact_info', 'priority' => 15 ) ) ); //Contact color $wp_customize->add_setting( 'contact_color', array( 'default' => '#c5c5c5', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'contact_color', array( 'label' => __('Contact color', 'sydney'), 'section' => 'sydney_contact_info', 'priority' => 15 ) ) ); } //___Below header widget area___// $wp_customize->add_section( 'sydney_extra_widget_area', array( 'title' => __('Extra widget area', 'sydney'), 'priority' => 1000, 'panel' => 'sydney_panel_general', 'description' => __('Here you can activate an extra widget area displayed below the header. After you activate it you can go to Appearance > Widgets to add widgets to it.', 'sydney'), ) ); //Activate $wp_customize->add_setting( 'activate_bh_widgets', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'activate_bh_widgets', array( 'type' => 'checkbox', 'label' => __('Activate the extra widget area?', 'sydney'), 'section' => 'sydney_extra_widget_area', 'priority' => 10, ) ); //Hide front page $wp_customize->add_setting( 'hide_bh_widgets', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'hide_bh_widgets', array( 'type' => 'checkbox', 'label' => __('Hide this widget area on the front page?', 'sydney'), 'section' => 'sydney_extra_widget_area', 'priority' => 11, ) ); //Center $wp_customize->add_setting( 'center_bh_widgets', array( 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( 'center_bh_widgets', array( 'type' => 'checkbox', 'label' => __('Center the content? [may or may not work, depending on the widgets]', 'sydney'), 'section' => 'sydney_extra_widget_area', 'priority' => 11, ) ); //Background color $wp_customize->add_setting( 'bg_bh_widgets', array( 'default' => '#ffffff', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'bg_bh_widgets', array( 'label' => __('Background color', 'sydney'), 'section' => 'sydney_extra_widget_area', 'priority' => 12 ) ) ); //Color $wp_customize->add_setting( 'color_bh_widgets', array( 'default' => '#767676', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'color_bh_widgets', array( 'label' => __('Color', 'sydney'), 'section' => 'sydney_extra_widget_area', 'priority' => 13 ) ) ); //Maps API key $wp_customize->add_setting( 'sydney_pro_maps_api', array( 'default' => '', 'sanitize_callback' => 'sydney_sanitize_text', ) ); $wp_customize->add_control( 'sydney_pro_maps_api', array( 'label' => __( 'Google Maps API key', 'sydney' ), 'section' => 'sydney_general', 'type' => 'text', 'priority' => 10, 'description' => __('You can obtain a free API key ', 'sydney') . '<a target="_blank" href="https://developers.google.com/maps/documentation/javascript/get-api-key">here</a>. You need to add your key in case you want to use the contact page template.' ) ); //___Pages___// $wp_customize->add_section( 'sydney_cpt_page', array( 'title' => __('Pages', 'sydney'), 'priority' => 13, ) ); /* Deprecated $wp_customize->add_setting( 'fullwidth_pages', array( 'default' => 0, 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( new Sydney_Toggle_Control( $wp_customize, 'fullwidth_pages', array( 'label' => esc_html__( 'Disable the sidebar on all pages', 'sydney' ), 'section' => 'sydney_page', ) ) ); */ $wp_customize->add_setting( 'enable_page_feat_images', array( 'default' => 0, 'sanitize_callback' => 'sydney_sanitize_checkbox', ) ); $wp_customize->add_control( new Sydney_Toggle_Control( $wp_customize, 'enable_page_feat_images', array( 'label' => esc_html__( 'Enable featured images on all pages', 'sydney' ), 'section' => 'sydney_cpt_page', ) ) ); $wp_customize->add_setting( 'page_section_divider_1', array( 'sanitize_callback' => 'esc_attr' ) ); $wp_customize->add_control( new Sydney_Divider_Control( $wp_customize, 'page_section_divider_1', array( 'section' => 'sydney_cpt_page', ) ) ); } add_action( 'customize_register', 'sydney_customize_register' ); /** * Sanitize */ //Header type function sydney_sanitize_layout( $input ) { $valid = array( 'crelly' => __('Crelly Slider', 'sydney'), 'slider' => __('Full screen slider', 'sydney'), 'image' => __('Image', 'sydney'), 'video' => __('Video', 'sydney'), 'core-video'=> __('Video', 'sydney'), 'shortcode' => __('Shortcode', 'sydney'), 'nothing' => __('No header (only menu)', 'sydney') ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } //Background size function sydney_sanitize_bg_size( $input ) { $valid = array( 'cover' => __('Cover', 'sydney'), 'contain' => __('Contain', 'sydney'), ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } //Footer widget areas function sydney_sanitize_fw( $input ) { $valid = array( '1' => __('One', 'sydney'), '2' => __('Two', 'sydney'), '3' => __('Three', 'sydney'), '4' => __('Four', 'sydney') ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } //Sticky menu function sydney_sanitize_sticky( $input ) { $valid = array( 'sticky' => __('Sticky', 'sydney'), 'static' => __('Static', 'sydney'), ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } //Blog Layout function sydney_sanitize_blog( $input ) { $valid = array( 'classic' => __( 'Classic', 'sydney' ), 'classic-alt' => __( 'Classic (alternative)', 'sydney' ), 'modern' => __( 'Modern', 'sydney' ), 'fullwidth' => __( 'Full width (no sidebar)', 'sydney' ), 'masonry-layout' => __( 'Masonry (grid style)', 'sydney' ) ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } //Menu style function sydney_sanitize_menu_style( $input ) { $valid = array( 'inline' => __('Inline', 'sydney'), 'centered' => __('Centered (menu and site logo)', 'sydney'), ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } //Titles transform function sydney_sanitize_transform( $input ) { $valid = array( 'uppercase'=> __('Uppercase', 'sydney'), 'none' => __('None', 'sydney'), ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } //Mobile slider function sydney_sanitize_mslider( $input ) { $valid = array( 'fullscreen' => __('Full screen', 'sydney'), 'responsive' => __('Responsive', 'sydney'), ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } //Titles alignment function sydney_sanitize_tstyle( $input ) { $valid = array( 'default' => __('Default', 'sydney'), 'bordered' => __('Bordered', 'sydney'), 'solid' => __('Solid', 'sydney'), ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } //Buttons function sydney_sanitize_buttons( $input ) { $valid = array( 'default' => __('Default', 'sydney'), 'bordered' => __('Bordered', 'sydney'), 'bordered-left-fill' => __('Bordered - left fill hover', 'sydney'), 'bordered-top-fill' => __('Bordered - top fill hover', 'sydney'), 'bordered-center-fill' => __('Bordered - center fill hover', 'sydney'), 'solid' => __('Solid', 'sydney'), ); if ( array_key_exists( $input, $valid ) ) { return $input; } else { return ''; } } //Checkboxes function sydney_sanitize_checkbox( $input ) { if ( $input == 1 ) { return 1; } else { return ''; } } function sydney_sanitize_font_weights( $input ) { if ( is_array( $input ) ) { return $input; } } function sydney_sanitize_header_custom_item( $input ) { if ( in_array( $input, array( 'nothing', 'button', 'html' ), true ) ) { return $input; } } function sydney_sanitize_menu_container( $input ) { if ( in_array( $input, array( 'container', 'fw-menu-container' ), true ) ) { return $input; } } /** * Selects */ function sydney_sanitize_selects( $input, $setting ){ $input = sanitize_key($input); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function sydney_customize_preview_js() { wp_enqueue_script( 'sydney_customizer', get_template_directory_uri() . '/js/customizer.min.js', array( 'customize-preview' ), '20221024', true ); $post_type_array = sydney_get_posts_types_for_js(); wp_localize_script( 'sydney_customizer', 'syd_data', array( 'post_types' => $post_type_array ) ); } add_action( 'customize_preview_init', 'sydney_customize_preview_js' ); /** * Load display conditions template */ require get_template_directory() . '/inc/customizer/controls/display-conditions/display-conditions-script-template.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound require get_template_directory() . '/inc/customizer/controls/display-conditions/ajax-callback.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound /** * Customizer assets */ function sydney_customize_footer_scripts() { wp_enqueue_style( 'sydney-customizer-styles', get_template_directory_uri() . '/css/customizer.min.css', '', '20221024' ); wp_enqueue_script( 'sydney-customizer-scripts', get_template_directory_uri() . '/js/customize-controls.min.js', array( 'jquery', 'jquery-ui-core' ), '20221024', true ); $post_type_array = sydney_get_posts_types_for_js(); wp_localize_script( 'sydney-customizer-scripts', 'syd_data', array( 'post_types' => $post_type_array, 'ajax_url' => admin_url( 'admin-ajax.php' ), 'ajax_nonce' => wp_create_nonce( 'sydney_ajax_nonce' ), ) ); } add_action( 'customize_controls_print_footer_scripts', 'sydney_customize_footer_scripts' ); /** * Ajax callbacks */ function sydney_customizer_ajax_callbacks() { require get_template_directory() . '/inc/customizer/ajax-callbacks.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound } add_action( 'init', 'sydney_customizer_ajax_callbacks' ); /** * Partials callbacks */ //Slider titles function sydney_partial_slider_title_1() { return get_theme_mod('slider_title_1', __('Welcome to Sydney','sydney')); } function sydney_partial_slider_title_2() { return get_theme_mod('slider_title_2', __('Ready to begin your journey?','sydney')); } function sydney_partial_slider_title_3() { return get_theme_mod('slider_title_3'); } function sydney_partial_slider_title_4() { return get_theme_mod('slider_title_4'); } function sydney_partial_slider_title_5() { return get_theme_mod('slider_title_5'); } //Slider subtitles function sydney_partial_slider_subtitle_1() { return get_theme_mod('slider_subtitle_1', __('Feel free to look around','sydney')); } function sydney_partial_slider_subtitle_2() { return get_theme_mod('slider_subtitle_2', __('Click the button below','sydney')); } function sydney_partial_slider_subtitle_3() { return get_theme_mod('slider_subtitle_3'); } function sydney_partial_slider_subtitle_4() { return get_theme_mod('slider_subtitle_4'); } function sydney_partial_slider_subtitle_5() { return get_theme_mod('slider_subtitle_5'); } function sydney_partial_slider_button_text() { return get_theme_mod('slider_button_text'); } //Header custom items active callbacks function sydney_header_custom_btn_active_callback() { $type = get_theme_mod( 'header_button_html' ); if ( 'button' == $type ) { return true; } else { return false; } } function sydney_header_custom_html_active_callback() { $type = get_theme_mod( 'header_button_html' ); if ( 'html' == $type ) { return true; } else { return false; } } function sydney_get_posts_types_for_js() { //Send post types to js $args = array( 'public' => true, ); $post_types = get_post_types( $args, 'objects' ); //Remove unwanted post types $unset_types = array( 'product', 'attachment', 'e-landing-page', 'elementor_library', 'athemes_hf', ); foreach ( $unset_types as $type ) { unset( $post_types[ $type ] ); } $post_type_array = array(); foreach ( $post_types as $post_type ) { $post_type_array[] = $post_type->name; } return $post_type_array; } /** * Render adobe fonts control kits * */ function sydney_customize_control_adobe_font_kits_output( $kits = false, $echo = true ) { if( $kits ) { if( ! $echo ) { ob_start(); } ?> <div class="sydney-adobe_fonts_kits_wrapper" style="margin-bottom: 25px;"> <p><?php echo esc_html__( 'You have the following data in your Adobe Fonts account.', 'sydney' ); ?></p> <?php foreach( $kits as $kit_id => $project ) : ?> <div class="sydney-adobe_fonts_kits_wrapper-item<?php echo ( $project[ 'enable' ] ? '' : ' disabled' ); ?>"> <ul> <li> <strong> <?php echo sprintf( /* translators: 1: Adobe fonts kit id */ esc_html__( 'Kit ID: %s', 'sydney' ), esc_html( $kit_id ) ); ?> </strong> </li> <li> <?php echo sprintf( /* translators: 1: Adobe fonts project name */ esc_html__( 'Project Name: %s', 'sydney' ), esc_html( $project[ 'project_name' ] ) ); ?> </li> <li> <?php $fonts_name = array(); foreach( $project[ 'families' ] as $family ) { $fonts_name[] = $family[ 'name' ]; } echo esc_html( implode( ', ', $fonts_name ) ); ?> </li> </ul> <div> <?php if( $project[ 'enable' ] ) : ?> <a href="#" class="sydney-adobe_fonts_kit_onoff" data-kit="<?php echo esc_attr( $kit_id ); ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'customize-typography-adobe-kits-control-onoff-nonce' ) ); ?>" data-loading-text="<?php echo esc_attr__( 'Loading...', 'sydney' ); ?>" data-enable-text="<?php echo esc_attr__( 'Enable', 'sydney' ); ?>" data-disable-text="<?php echo esc_attr__( 'Disable', 'sydney' ); ?>"><?php echo esc_html__( 'Disable', 'sydney' ); ?></a> <?php else : ?> <a href="#" class="sydney-adobe_fonts_kit_onoff" data-kit="<?php echo esc_attr( $kit_id ); ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'customize-typography-adobe-kits-control-onoff-nonce' ) ); ?>" data-loading-text="<?php echo esc_attr__( 'Loading...', 'sydney' ); ?>" data-enable-text="<?php echo esc_attr__( 'Enable', 'sydney' ); ?>" data-disable-text="<?php echo esc_attr__( 'Disable', 'sydney' ); ?>"><?php echo esc_html__( 'Enable', 'sydney' ); ?></a> <?php endif; ?> </div> <div class="reload-message"> <em> <?php echo wp_kses_post( /* Translators: */ sprintf( __( 'Reload the page is required to get it working across all typography options. <a href="%s">Click here</a> to reload the page.', 'sydney' ), admin_url( '/customize.php?autofocus[section]=sydney_section_typography_general' ) ) ); ?> </em> </div> </div> <?php endforeach; ?> </div> <?php if( ! $echo ) { return ob_get_clean(); } } }
[+]
..
[+]
controls
[+]
options
[+]
upsell
[-] ajax-callbacks.php
[edit]
[-] callbacks.php
[edit]
[-] customizer-hooks.php
[edit]
[-] customizer.php
[edit]
[-] sanitize.php
[edit]
[-] .htaccess.disabled
[edit]