Last active
May 26, 2017 13:55
-
-
Save devinsays/b69da4ad3dd11cc7fc08 to your computer and use it in GitHub Desktop.
Page Selector in Customizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add page selector to the customizer. | |
* | |
* @since Theme 1.0.0 | |
* | |
* @param WP_Customize_Manager $wp_customize Customizer object. | |
*/ | |
function prefix_customize_register( $wp_customize ) { | |
$wp_customize->add_section( 'showcase' , array( | |
'title' => __( 'Showcase', 'textdomain' ), | |
'priority' => 30, | |
) ); | |
for ( $count = 1; $count <= 4; $count++ ) { | |
// Add color scheme setting and control. | |
$wp_customize->add_setting( 'showcase-page-' . $count, array( | |
'default' => '', | |
'sanitize_callback' => 'absint' | |
) ); | |
$wp_customize->add_control( 'showcase-page-' . $count, array( | |
'label' => __( 'Select Page', 'textdomain' ), | |
'section' => 'showcase', | |
'type' => 'dropdown-pages' | |
) ); | |
} | |
} | |
add_action( 'customize_register', 'prefix_customize_register' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment