Skip to content

Commit

Permalink
Basic Panel 馃挴
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Awais committed May 26, 2016
1 parent 8a785bc commit a427fc6
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 19 deletions.
55 changes: 48 additions & 7 deletions customizer/panel/wpcustomize.php
Expand Up @@ -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',
) );
}
}
4 changes: 2 additions & 2 deletions customizer/wpc-init.php
Expand Up @@ -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' );
}
20 changes: 10 additions & 10 deletions functions.php
Expand Up @@ -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'
);
}
}


Expand Down

0 comments on commit a427fc6

Please sign in to comment.