Created
January 18, 2013 12:43
-
-
Save bueltge/4564337 to your computer and use it in GitHub Desktop.
Example to use the User List 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-user_select_custom_control.php' ); | |
$wp_customize->add_section( | |
'my_theme_blog_featured_user_list', array( | |
'title' => __( 'Featured User List', 'textdomain' ), | |
'priority' => 36, | |
'description' => __( 'Manage User List', 'textdomain' ), | |
) | |
); | |
$wp_customize->add_setting( | |
'featured_user_list_1', array( | |
'default' => __( 'Default User', 'textdomain' ), | |
) | |
); | |
$wp_customize->add_control( | |
new User_Select_Custom_Control( | |
$wp_customize, 'featured_user_list_1', array( | |
'label' => __( 'Featured User List 1', 'textdomain' ), | |
'section' => 'my_theme_blog_featured_user_list', | |
'settings' => 'featured_user_list_1', | |
'description' => __( 'Select a User from List', 'textdomain' ), | |
'query' => array( 'role' => 'author' ), | |
) | |
) | |
); | |
return $wp_customize; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Greetings,
I currently use your excellent "Multisite Enhancements" plug-in, and found this project when looking to see what other helpful things you may have created. I've done a ton of web development over the years (pretty much HTML, CSS, and JavaScript/jQuery), but am just learning PHP and the wonderfully complex underside of WordPress.
I'm pretty familiar w/ adding PHP code sections to my WP installation (via functions.php, shortcodes, and per-page injection). I have recently added a function to populate a Gravity Forms dropdown w/ a list of WP registered usernames, but I would much rather use an established code-base from a seasoned developer. :)
Anyway... I hoping you would be willing to explain a bit more about how someone like myself could begin implementing your "Wordpress-Theme-Customizer-Custom-Controls".
Cheers, Dustin