This plugin adds a Customizer control to select one or multiple posts (and eventually terms and users).
Core has long had a
dropdown-pages control type which is used in the static front page section for the “page on front” and “page for posts” controls. There is a problem with this control however: it outputs the entire tree of pages for every registered instance of the control. For sites that have a lot of pages, this can introduce a performance problem to generate this full list, not only once, but twice for the two controls. This plugin upgrades the “page on front” and “page for posts” controls to instead make use of the Customize Object Selector control, not only allowing for the list of pages to be loaded via Ajax on demand but also for the list to be searched.
When the Customize Posts plugin is active, buttons will appear after the Select2 control to be able to create new posts to add to the selection. The Customize Object Selector will also power the post parent control. See wp-customize-posts#233.
wp.customize.ObjectSelectorComponent which can be used in widgets or other locations.
For an example integration with widgets, see the Post Collection widget.
For an example integration with the Customize Posts plugin, see pending usage as the Post Parent control.
There are no reviews for this plugin.
Contributors & Developers
“Customize Object Selector” is open source software. The following people have contributed to this plugin.Contributors
Interested in development?
0.4.2 – 2017-11-01
- Bump minimum WP to 4.7 and indicated tested up to 4.9.
ObjectSelectorControlto allow passing
0.4.1 – 2017-02-17
- Increase importance of
z-indexin CSS rule for Select2 dropdown for compatibility with conflicting rule in Shortcake.
- Fix bug with clearing a selection. See #31
LIKEto be used in meta queries for object selector searches. See #32
0.4.0 – 2017-01-08
- Add an edit shortcut in selected posts to open corresponding post section from Customize Posts; re-use
wp.customize.Posts.startEditPostFlow(). See #8, PR #12.
- Add ability to whitelist additional query vars via
customize_object_selector_post_query_varsfilter. See PR #25.
- Fix Select2 elements erroneously appearing on top of a section’s header. See PR #26.
- Add ability to use Customize Object Selector component outside of the customizer entirely. Immediate use case is for JS Widgets and its Post Collection widget. See PR #27.
0.3.0 – 2016-09-21
- Add support for emulating
wp_dropdown_pages(). The options for a dropdown are fetched via a call to
get_pages(), and these dropdown options are displayed when no search is entered and
show_initial_dropdown: trueis passed among the
post_query_vars. The arguments for
wp_dropdown_pages()can then be passed via the
page_for_postscontrols with object selector controls emulating
- Add a control param for
show_add_buttonsto control whether or not the add buttons are shown (if Customize Posts is active).
- Eliminates code in
setupAddNewButtonsin favor of re-using
startCreatePostFlowcode now in Customize Posts 0.8.0. This sets the initial placeholder title for created posts and navigate to url in preview.
- Show loading indicator while re-population is happening.
page_for_postsfrom being set the same.
- Ensure strings are translatable.
- Add banner and icon assets.
posts_per_pageto be set too early.
- Skip calling close on select2 if element already gone. Fixes JS error.
- Fix issues related to syncing the setting value to the select2 value.
- Ensure notifications are set on containing construct.
- Fix transport implementation by returning request object.
- Pass params from control to component by reference without cloning so that params can be adjusted on control to affect the component. (Not ideal long term.)
Initial release of fork from Customizer Ajax Select.