├── img
├── 2cl.png
├── 2cr.png
└── 1col.png
├── .gitattributes
├── text_editor_custom_control.php
├── category_dropdown_custom_control.php
├── date_picker_custom_control.php
├── tags_dropdown_custom_control.php
├── menu_dropdown_custom_control.php
├── post_dropdown_custom_control.php
├── README.md
├── post_type_dropdown_custom_control.php
├── layout_picker_custom_control.php
├── class-textarea_custom_control.php
├── .gitignore
├── class-taxonomy_dropdown_custom_control.php
└── class-user_select_custom_control.php
/img/2cl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bueltge/WordPress-Theme-Customizer-Custom-Controls/HEAD/img/2cl.png
--------------------------------------------------------------------------------
/img/2cr.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bueltge/WordPress-Theme-Customizer-Custom-Controls/HEAD/img/2cr.png
--------------------------------------------------------------------------------
/img/1col.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bueltge/WordPress-Theme-Customizer-Custom-Controls/HEAD/img/1col.png
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/text_editor_custom_control.php:
--------------------------------------------------------------------------------
1 |
15 |
25 |
--------------------------------------------------------------------------------
/category_dropdown_custom_control.php:
--------------------------------------------------------------------------------
1 |
10 |
22 |
--------------------------------------------------------------------------------
/date_picker_custom_control.php:
--------------------------------------------------------------------------------
1 |
24 |
28 |
--------------------------------------------------------------------------------
/tags_dropdown_custom_control.php:
--------------------------------------------------------------------------------
1 |
16 |
29 |
--------------------------------------------------------------------------------
/menu_dropdown_custom_control.php:
--------------------------------------------------------------------------------
1 |
16 |
29 |
--------------------------------------------------------------------------------
/post_dropdown_custom_control.php:
--------------------------------------------------------------------------------
1 |
16 |
29 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WordPress Theme Customizer Custom Controls
2 |
3 | The WordPress theme customizer allows you to change the style and functionality of your WordPress theme and see the changes you make in real time without saving the WordPress theme.
4 |
5 | Here is a collection of Custom controls you can use on your theme customizer.
6 |
7 | So far this collection consists of:
8 |
9 | - Category Dropdown - Creates a dropdown of all the categories on your WordPress theme.
10 | - Date Picker - Adds a date picker control to the theme customizer.
11 | - Layout Picker - Adds 3 images of layouts to the page for you to select a new style.
12 | - Menu Dropdown - Creates a dropdown of all the menus on your WordPress site.
13 | - Post Dropdown - Creates a dropdown of all the posts on your WordPress site.
14 | - Tags Dropdown - Creates a dropdown of all tags on your WordPress site.
15 | - Text Editor - Creates a textbox with the TinyMCE textarea.
16 | - Textarea - Creates a textarea input field
17 | - Taxonomy Dropdown - Creates a dropdown of taxonomies ( Usage: see [Gist 4538951](https://gist.github.com/4538951) )
18 | - User List Dropdown - Creates a dropdown of users for a role ( Usage: see [Gist 4564337](https://gist.github.com/4564337) )
19 |
--------------------------------------------------------------------------------
/post_type_dropdown_custom_control.php:
--------------------------------------------------------------------------------
1 |
16 |
29 |
--------------------------------------------------------------------------------
/layout_picker_custom_control.php:
--------------------------------------------------------------------------------
1 |
16 |
24 |
--------------------------------------------------------------------------------
/class-textarea_custom_control.php:
--------------------------------------------------------------------------------
1 |
10 | */
11 |
12 | if ( ! class_exists( 'WP_Customize_Control' ) )
13 | return NULL;
14 |
15 | class Textarea_Custom_Control extends WP_Customize_Control {
16 |
17 | /**
18 | * @access public
19 | * @var string
20 | */
21 | public $type = 'textarea';
22 |
23 | /**
24 | * @access public
25 | * @var array
26 | */
27 | public $statuses;
28 |
29 | /**
30 | * Constructor.
31 | *
32 | * If $args['settings'] is not defined, use the $id as the setting ID.
33 | *
34 | * @since 10/16/2012
35 | * @uses WP_Customize_Control::__construct()
36 | * @param WP_Customize_Manager $manager
37 | * @param string $id
38 | * @param array $args
39 | * @return void
40 | */
41 | public function __construct( $manager, $id, $args = array() ) {
42 |
43 | $this->statuses = array( '' => __( 'Default' ) );
44 | parent::__construct( $manager, $id, $args );
45 | }
46 |
47 | /**
48 | * Render the control's content.
49 | *
50 | * Allows the content to be overriden without having to rewrite the wrapper.
51 | *
52 | * @since 10/16/2012
53 | * @return void
54 | */
55 | public function render_content() {
56 | ?>
57 |
63 |
10 | * @usage https://gist.github.com/4538951
11 | */
12 |
13 | if ( ! class_exists( 'WP_Customize_Control' ) )
14 | return NULL;
15 |
16 | class Taxonomy_Dropdown_Custom_Control extends WP_Customize_Control {
17 |
18 | /**
19 | * @access public
20 | * @var string
21 | */
22 | public $type = 'taxonomy_dropdown';
23 |
24 | /**
25 | * @access public
26 | * @var array
27 | */
28 | public $statuses;
29 |
30 | /**
31 | * @access public
32 | * @var array
33 | */
34 | public $defaults = array();
35 |
36 | /**
37 | * @access public
38 | * @var array
39 | */
40 | public $args = array();
41 | /**
42 | * Constructor.
43 | *
44 | * If $args['settings'] is not defined, use the $id as the setting ID.
45 | *
46 | * @since 11/14/2012
47 | * @uses WP_Customize_Control::__construct()
48 | * @param WP_Customize_Manager $manager
49 | * @param string $id
50 | * @param array $args
51 | * @return void
52 | */
53 | public function __construct( $manager, $id, $args = array() ) {
54 |
55 | $this->statuses = array( '' => __( 'Default' ) );
56 | parent::__construct( $manager, $id, $args );
57 | }
58 |
59 | /**
60 | * Render the control's content.
61 | *
62 | * Allows the content to be overriden without having to rewrite the wrapper.
63 | *
64 | * @since 11/14/2012
65 | * @return void
66 | */
67 | public function render_content() {
68 |
69 | // call wp_dropdown_cats to get data and add to select field
70 | add_action( 'wp_dropdown_cats', array( $this, 'wp_dropdown_cats' ) );
71 |
72 | // Set defaults
73 | $this->defaults = array(
74 | 'show_option_none' => __( 'None' ),
75 | 'orderby' => 'name',
76 | 'hide_empty' => 0,
77 | 'id' => $this->id,
78 | 'selected' => $this->value()
79 | );
80 |
81 | // parse defaults and user data
82 | $cats = wp_parse_args(
83 | $this->args,
84 | $this->defaults
85 | );
86 |
87 | ?>
88 |
92 | get_link(), $output );
106 |
107 | return $output;
108 | }
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/class-user_select_custom_control.php:
--------------------------------------------------------------------------------
1 |
10 | * @usage https://gist.github.com/4564337
11 | */
12 |
13 | if ( ! class_exists( 'WP_Customize_Control' ) )
14 | return NULL;
15 |
16 | class User_Select_Custom_Control extends WP_Customize_Control {
17 |
18 | /**
19 | * @access public
20 | * @var string
21 | */
22 | public $type = 'option';
23 |
24 | /**
25 | * @access public
26 | * @var array
27 | */
28 | public $statuses;
29 |
30 | /**
31 | * @access public
32 | * @var array
33 | */
34 | public $query = array( 'orderby' => 'nicename' );
35 |
36 | /**
37 | * @access public
38 | * @var array
39 | */
40 | public $description;
41 |
42 | /**
43 | * @access public
44 | * @var string
45 | */
46 | public $textdomain = 'default';
47 |
48 | /**
49 | * Constructor.
50 | *
51 | * If $args['settings'] is not defined, use the $id as the setting ID.
52 | *
53 | * @since 10/16/2012
54 | * @uses WP_Customize_Control::__construct()
55 | * @param WP_Customize_Manager $manager
56 | * @param string $id
57 | * @param array $args
58 | * @return void
59 | */
60 | public function __construct( $manager, $id, $args = array() ) {
61 |
62 | $this->statuses = array( '' => __( 'Default' ) );
63 | parent::__construct( $manager, $id, $args );
64 | }
65 |
66 | /**
67 | * Render the control's content.
68 | *
69 | * Allows the content to be overriden without having to rewrite the wrapper.
70 | *
71 | * @since 01/13/2013
72 | * @return void
73 | */
74 | public function render_content() {
75 |
76 | $query = $this->query;
77 | $users = $this->get_user_array($query);
78 | ?>
79 |
97 | ID}"] = $items->user_nicename;
112 | }
113 |
114 | if ( empty( $users ) )
115 | return NULL;
116 | //$users[1] = __( 'Can`t find a user in the role', 'textdomain' ) . ' ' . esc_attr( $args['role'] );
117 |
118 | return $users;
119 | }
120 |
121 | } // end class
122 |
--------------------------------------------------------------------------------