admin管理员组文章数量:1125362
I'd like to display a grid of authors on my site showing the name of the author and their avatar. The tricky part is, I'd like to be able to control this from the Menus page in the dashboard so I have control over who is displayed and in what order they are displayed.
Is this doable? I don't think a custom walker would work in this situation as it wouldn't allow for arbitrary order and selection control. So my next thought is how to add another selector on the menus page for authors. Any help?
I'd like to display a grid of authors on my site showing the name of the author and their avatar. The tricky part is, I'd like to be able to control this from the Menus page in the dashboard so I have control over who is displayed and in what order they are displayed.
Is this doable? I don't think a custom walker would work in this situation as it wouldn't allow for arbitrary order and selection control. So my next thought is how to add another selector on the menus page for authors. Any help?
Share Improve this question asked Oct 28, 2013 at 18:48 javyjavy 4561 gold badge6 silver badges18 bronze badges 3- 2 Walker doesn't control order and selection, it just turns supplied hierarchical data into resulting output. – Rarst Commented Oct 28, 2013 at 18:50
- So the next option would be to try to hook into the metabox on the Menus page, agreed? – javy Commented Oct 28, 2013 at 18:59
- 1 If going for the next option: wordpress.stackexchange.com/q/101710 – brasofilo Commented Oct 28, 2013 at 19:13
2 Answers
Reset to default 0I don't really understand why you want to use a menu to control this but it wouldn't be very hard. First you obviously need a new page template for your grid which you will use get_users to pull your users for display - https://codex.wordpress.org/Function_Reference/get_users
Now if you want to control the order and whom is included in the grid via a menu what you would do is use the function wp_get_nav_menu_items() to get the items of your menu so that you can loop through the items and update the include parameter of get_users accordingly based on your menu items.
I think you are getting confused about how you would control a grid of authors on a page. It's not something you would control through the menus part of WordPress as that is designed to simply be used with menus only and not the main content on the page. I would suggest finding a plugin that you can use as a block or widget on your site to select your authors from your complete list. I'm unfamiliar with one of these off have but it may be something someone has made before. This one seems to work quite well; for example, you may be able to customise it for your needs... link to popular post's author's plugin
本文标签: Link to Author archive from Navigation Menus in dashboard
版权声明:本文标题:Link to Author archive from Navigation Menus in dashboard? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736659541a1946346.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论