Last active
June 15, 2017 05:39
-
-
Save bueltge/4538951 to your computer and use it in GitHub Desktop.
Example to use the taxonomie Dropdown for Customizer, the classes are inside the project: https://github.com/bueltge/Wordpress-Theme-Customizer-Custom-Controls
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
<?php | |
/** | |
* @see: https://github.com/bueltge/Wordpress-Theme-Customizer-Custom-Controls | |
*/ | |
add_action( 'customize_register', 'fb_customize_register' ); | |
function fb_customize_register( $wp_customize ) { | |
require_once( 'class-taxonomy_dropdown_custom_control.php' ); | |
$wp_customize->add_section( | |
'my_theme_blog_featured_categories', array( | |
'title' => __( 'Featured Categories', 'textdomain' ), | |
'priority' => 36, | |
'args' => array(), // arguments for wp_dropdown_categories function..., optional | |
) | |
); | |
$wp_customize->add_setting( | |
'featured_category_1', array( | |
'default' => get_option( 'default_category', '' ), | |
) | |
); | |
$wp_customize->add_control( | |
new Taxonomy_Dropdown_Custom_Control( | |
$wp_customize, 'featured_category_1', array( | |
'label' => __( 'Featured Area 1', 'textdomain' ), | |
'section' => 'my_theme_blog_featured_categories', | |
'settings' => 'featured_category_1', | |
) | |
) | |
); | |
return $wp_customize; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment