| 开发者 |
xwp
westonruter |
|---|---|
| 更新时间 | 2017年11月9日 14:36 |
| PHP版本: | 5.3 及以上 |
| WordPress版本: | 4.9.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
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.
This plugin also includes a reusable JavaScript component available at 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.
Development of this plugin is done on GitHub. Pull requests welcome. Please see issues reported there before going to the plugin forum.
ObjectSelectorControl to allow passing options without options.params.z-index in CSS rule for Select2 dropdown for compatibility with conflicting rule in Shortcake.LIKE to be used in meta queries for object selector searches. See #32customize_object_selector_result filter.wp.customize.Posts.startEditPostFlow(). See #8, PR #12.customize_object_selector_post_query_vars filter. See PR #25.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: true is passed among the post_query_vars. The arguments for wp_dropdown_pages() can then be passed via the dropdown_args query var.page_on_front and page_for_posts controls with object selector controls emulating wp_dropdown_pages().show_add_buttons to control whether or not the add buttons are shown (if Customize Posts is active).setupAddNewButtons in favor of re-using startCreatePostFlow code now in Customize Posts 0.8.0. This sets the initial placeholder title for created posts and navigate to url in preview.page_on_front and page_for_posts from being set the same.post_query_args to post_query_vars in PHP.post__in from causing posts_per_page to be set too early.