125 lines
3.9 KiB
PHP
125 lines
3.9 KiB
PHP
<?php
|
|
/**
|
|
* Sophia After Dark manage the Customizer options of general panel.
|
|
*
|
|
* @package Sophia After Dark
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
add_action( 'customize_register', 'sophia_after_dark_customize_general_panels_sections_register' );
|
|
/**
|
|
* Add panels in the theme customizer
|
|
*
|
|
*/
|
|
function sophia_after_dark_customize_general_panels_sections_register( $wp_customize ) {
|
|
/*------------------------------------------- Site Settings Section -----------------------------------------------*/
|
|
/**
|
|
* Site Settings Section
|
|
*/
|
|
$wp_customize->add_section( 'sophia_after_dark_section_site',
|
|
array(
|
|
'priority' => 40,
|
|
'panel' => 'sophia_after_dark_general_panel',
|
|
'capability' => 'edit_theme_options',
|
|
'theme_supports' => '',
|
|
'title' => __( 'Site Settings', 'sophia-after-dark' )
|
|
|
|
)
|
|
);
|
|
|
|
/**
|
|
* Toggle field for Enable/Disable wow animation.
|
|
*
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_enable_wow_animation',
|
|
array(
|
|
'capability' => 'edit_theme_options',
|
|
'default' => true,
|
|
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
|
|
)
|
|
);
|
|
|
|
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
|
|
$wp_customize, 'sophia_after_dark_enable_wow_animation',
|
|
array(
|
|
'label' => __( 'Enable Wow Animation', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_site',
|
|
'settings' => 'sophia_after_dark_enable_wow_animation',
|
|
'priority' => 10,
|
|
)
|
|
)
|
|
);
|
|
$wp_customize->add_control(new WP_Customize_Image_control(
|
|
$wp_customize, 'sophia_after_dark_home_og_image', array(
|
|
'label' => __('Home Page Open Graph Image', 'sophia_after_dark'),
|
|
'section' => 'sophia_after_dark_section_site',
|
|
'settings' => 'sophia_after_dark_home_og_image',
|
|
'priority' => 15,
|
|
)
|
|
)
|
|
);
|
|
|
|
$users = get_users();
|
|
$user_choices = array();
|
|
foreach ($users as $user) {
|
|
$user_choices[$user->ID] = $user->display_name;
|
|
}
|
|
$wp_customize->add_control('sophia_after_dark_home_og_user', array(
|
|
'label' => __('Select User for Open Graph Tags', 'sophia_after_dark'),
|
|
'section' => 'sophia_after_dark_section_site',
|
|
'settings' => 'sophia_after_dark_home_og_user',
|
|
'type' => 'select',
|
|
'choices' => $user_choices,
|
|
'priority' => 20,
|
|
)
|
|
);
|
|
/**
|
|
* Radio image field for Archive Sidebar
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_site_layout',
|
|
array(
|
|
'default' => 'site-layout--wide',
|
|
'sanitize_callback' => 'sanitize_key',
|
|
)
|
|
);
|
|
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
|
|
$wp_customize, 'sophia_after_dark_site_layout',
|
|
array(
|
|
'label' => __( 'Site Layout', 'sophia-after-dark' ),
|
|
'description' => __( 'Choose site layout from available layouts', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_site',
|
|
'settings' => 'sophia_after_dark_site_layout',
|
|
'priority' => 25,
|
|
'choices' => array(
|
|
'site-layout--wide' => get_template_directory_uri() . '/assets/images/full-width.png',
|
|
'site-layout--boxed' => get_template_directory_uri() . '/assets/images/boxed-layout.png'
|
|
),
|
|
)
|
|
)
|
|
);
|
|
|
|
/**
|
|
* Toggle field for block based widget editor.
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_enable_widgets_editor',
|
|
array(
|
|
'capability' => 'edit_theme_options',
|
|
'default' => false,
|
|
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
|
|
)
|
|
);
|
|
|
|
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
|
|
$wp_customize, 'sophia_after_dark_enable_widgets_editor',
|
|
array(
|
|
'label' => __( 'Enable Widgets Editor', 'sophia-after-dark' ),
|
|
'description' => __( 'Enable/disable Block-based Widgets Editor(since WordPress 5.8).', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_site',
|
|
'settings' => 'sophia_after_dark_enable_widgets_editor',
|
|
'priority' => 25,
|
|
)
|
|
)
|
|
);
|
|
} |