
內容簡介
此外掛提供自訂器(Customizer)控制項,以選擇一或多個文章(以及最終的專案和使用者選擇)。
一直以來,核心版本擁有一個 dropdown-pages 控制類型,這個類型用於靜態首頁中的「顯示在首頁的頁面」和「文章頁面」控制。但這個控制項存在一個問題:對於每一個已註冊的控制項實例,它都會輸出整個頁面樹。對於具有許多頁面的網站,這可能會引入性能問題,因為需要生成這個完整列表,不僅一次,而是兩次(對於那兩個控制項)。此外掛的解決方案為「顯示在首頁的頁面」和「文章頁面」控件升級為使用 Customize Object Selector 控制項,這樣不僅僅允許按需 Ajax 加載頁面列表,還允許搜索列表。
當啟用 Customize Posts 外掛後,可以在選擇器控制項之後看到按鈕,以添加新的文章到選擇器中。Customize Object Selector 還可以用於支持文章父節點控制。詳情參閱 wp-customize-posts#233。
此外掛還包括可重複使用的 JavaScript 組件,可在小工具或其他位置使用,可用 wp.customize.ObjectSelectorComponent 訪問。
有關小工具的示例集成,請參閱 Post Collection widget。有關與 Customize Posts 外掛的示例集成,請參閱文章父節點控制。
此外掛的開發位於 GitHub,歡迎進行 Pull Request。請先查看該處報告的問題,再去到 外掛討論區發布問題。
外掛標籤
開發者團隊
原文外掛簡介
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.
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.
