diff --git a/customizer/panel/wpcustomize.php b/customizer/panel/wpcustomize.php index dad27f1..0f9b630 100644 --- a/customizer/panel/wpcustomize.php +++ b/customizer/panel/wpcustomize.php @@ -13,11 +13,52 @@ exit; } +// Customize function. +if ( ! function_exists( 'wpc_customize_panel' ) ) { + // Customize Register action. + add_action( 'customize_register', 'wpc_customize_panel' ); -// Panel: WPCustomize. -$wp_customize->add_panel( 'wpc_panel_wpcustomize', array( - 'priority' => 10, - 'title' => __( 'WPCustomize Panle', 'WPC' ), - 'description' => __( 'WPCustomize Panel Description', 'WPC' ), - 'capability' => 'edit_theme_options' -) ); + /** + * Customize Panel. + * + * Adds a Panel, Section with basic controls. + * + * @param object WP_Customize $wp_customize Instance of the WP_Customize_Manager class. + * @since 1.0.0 + */ + function wpc_customize_panel( $wp_customize ) { + // Panel: WPCustomize. + $wp_customize->add_panel( 'wpc_panel_wpcustomize', array( + 'priority' => 10, + 'title' => __( 'WPCustomize Panel', 'WPC' ), + 'description' => __( 'WPCustomize Panel Description', 'WPC' ), + 'capability' => 'edit_theme_options' + ) ); + + // Section: WPCustomize. + $wp_customize->add_section( 'wpc_section_wpcustomize', array( + 'priority' => 10, + 'panel' => 'wpc_panel_wpcustomize', + 'title' => __( 'Section Title', 'WPC' ), + 'description' => __( 'Section Description.', 'WPC' ), + 'capability' => 'edit_theme_options' + ) ); + + // Setting: Text. + $wp_customize->add_setting( 'wpc_text', array( + 'type' => 'theme_mod', + 'default' => 'Placeholder.', + 'transport' => 'refresh', // Options: refresh or postMessage. + 'capability' => 'edit_theme_options', + 'sanitize_callback' => 'esc_attr' + ) ); + + // Control: Text. + $wp_customize->add_control( 'wpc_text', array( + 'label' => __( 'Text', 'WPC' ), + 'description' => __( 'Description', 'WPC' ), + 'section' => 'wpc_section_wpcustomize', + 'type' => 'text', + ) ); + } +} diff --git a/customizer/wpc-init.php b/customizer/wpc-init.php index eacf44f..070d2ae 100644 --- a/customizer/wpc-init.php +++ b/customizer/wpc-init.php @@ -18,6 +18,6 @@ * * @since 1.0.0 */ -if ( file_exists( WPC_DIR . '/customizer/panel/wpcutomize.php' ) ) { - require_once( WPC_DIR . '/customizer/panel/wpcutomize.php' ); +if ( file_exists( WPC_DIR . '/customizer/panel/wpcustomize.php' ) ) { + require_once( WPC_DIR . '/customizer/panel/wpcustomize.php' ); } diff --git a/functions.php b/functions.php index ca35784..3f8f5d3 100644 --- a/functions.php +++ b/functions.php @@ -36,16 +36,16 @@ * * @since 1.0.0 */ - function wpc_theme_styles() { - // Theme Styles. - wp_enqueue_style( - 'wpc', - WPC_URL . '/style.css', - array(), - '1.0.0', - 'all' - ); - } + function wpc_theme_styles() { + // Theme Styles. + wp_enqueue_style( + 'wpc', + WPC_URL . '/style.css', + array(), + '1.0.0', + 'all' + ); + } }