Create a gist now

Instantly share code, notes, and snippets.

@bueltge /example.php
Last active Jun 15, 2017

Embed
What would you like to do?
Example to use the taxonomie Dropdown for Customizer, the classes are inside the project: https://github.com/bueltge/Wordpress-Theme-Customizer-Custom-Controls
<?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