admin管理员组文章数量:1302913
I have a custom plugin page and I want users to be able to select posts/pages and add them to a list.
I was hoping to use the same UI as found on the Appearance > Menus Page which I picture below
Is there a function to specifically print this UI into the page?
I have a custom plugin page and I want users to be able to select posts/pages and add them to a list.
I was hoping to use the same UI as found on the Appearance > Menus Page which I picture below
Is there a function to specifically print this UI into the page?
Share Improve this question asked Feb 17, 2021 at 18:18 Thomas HarrisThomas Harris 1431 silver badge5 bronze badges 1- Thomas, I'm not sure if this does exist as I've never actually checked, but in instances like this I usually use Select2 inputs where the user starts typing and once there's at least 3 letters an AJAX search starts executing and returns matching results. – Tony Djukic Commented Feb 17, 2021 at 18:50
1 Answer
Reset to default 0No, there's no existing function available for an equivalent UI for posts or pages.
The whole UI in your screenshot is provided by the post_categories_meta_box()
function, which uses wp_category_checklist()
internally for the actual checkboxes, which implements the Walker_Category_Checklist
class. All of these are built for listing terms as checkboxes, and can't be repurposed for listing posts.
You would need to implement this yourself (although if you look at the source for post_categories_meta_box()
you might be able to use matching markup to ensure visual consistency.
本文标签: wp adminFunction to get a 39post selector39 UI
版权声明:本文标题:wp admin - Function to get a 'post selector' UI? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741741837a2395320.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论