如何在下拉列表中显示 WordPress 作者列表,并带有作者模板的链接?
我正在寻找一种方法,将 WordPress 博客的作者显示为下拉菜单,并通过一个 on Change 事件将用户重定向到作者页面,该页面列出了该用户之前撰写的所有帖子。
有没有办法做到这一点?
I'm looking for a way to display the authors of a wordpress blog as a dropdown menu, with an on change event that redirects the user to the author page, which lists all the previous posts written by that user.
Is there a way to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更新 实际上,您应该能够简单地使用 wp_list_authors() 来完成整个事情,因为它会自动生成一个作者列表,并带有指向显示其所有帖子的页面的链接。 有关详细信息,请参阅 http://codex.wordpress.org/Template_Tags/wp_list_authors#Markup_and_Styling_of_Author_Lists细节。
我正在使用这个插件来显示作者的帖子,效果很好。 http://www.dagondesign.com/articles/posts -by-author-plugin-for-wordpress/
我有一个author.php模板,它显示作者的信息(图片,简介),在它下面我使用上面的插件显示他们最近的5篇文章。
为了显示图片,我正在使用这个插件: http://wordpress.org/extend/ plugins/user-photo/
要获取下拉内容,您可以使用此 wp 函数:
UPDATE Actually, you should simply be able to use wp_list_authors() for the whole thing, as it automatically generates a list of authors with a link to a page displaying all their posts. See http://codex.wordpress.org/Template_Tags/wp_list_authors#Markup_and_Styling_of_Author_Lists for more details.
I'm using this plugin to display posts-by-author and it works well. http://www.dagondesign.com/articles/posts-by-author-plugin-for-wordpress/
I have an author.php template which displays the author's info (pic, blurb) and below it I'm showing their 5 most recent posts using the plugin above.
To show the pic I'm using this plugin: http://wordpress.org/extend/plugins/user-photo/
To get the dropdown contents you could use this wp function:
WordPress 现在添加了一个功能来执行此操作:
您只需输入参数即可。 如果您需要带有提交按钮的 HTML 表单示例,这里有一个 http://bit.ly/wWunIE
希望有帮助。
WordPress has now added a function to do this:
You just have to enter in your arguments. If you need a sample of this in an HTML form with a submit button, there is one here http://bit.ly/wWunIE
Hope that helps.