如何在下拉列表中显示wordpress作者列表,并带有作者模板的链接?

时间:2022-10-09 07:20:30

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.

我正在寻找一种方法来显示wordpress博客的作者作为下拉菜单,其中有一个on change事件,将用户重定向到作者页面,该页面列出了该用户编写的所有先前帖子。

Is there a way to do that?

有没有办法做到这一点?

2 个解决方案

#1


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.

更新实际上,您应该只需要使用wp_list_authors()来完成整个事情,因为它会自动生成一个作者列表,其中包含指向显示其所有帖子的页面的链接。有关详细信息,请参阅http://codex.wordpress.org/Template_Tags/wp_list_authors#Markup_and_Styling_of_Author_Lists。

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/

我正在使用这个插件来显示作者的帖子,它运作良好。 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.

我有一个author.php模板,显示作者的信息(pic,blurb),在它下面,我正在使用上面的插件显示他们最近的5个帖子。

To show the pic I'm using this plugin: http://wordpress.org/extend/plugins/user-photo/

要显示我正在使用此插件的图片:http://wordpress.org/extend/plugins/user-photo/

To get the dropdown contents you could use this wp function:

要获取下拉内容,您可以使用此wp函数:

<?php wp_list_authors(); ?>

#2


WordPress has now added a function to do this:

WordPress现在添加了一个函数来执行此操作:

<?php wp_dropdown_users( $args ); ?>

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

你只需要输入你的论点。如果你需要一个带有提交按钮的HTML表单的样本,那么这里有一个http://bit.ly/wWunIE

Hope that helps.

希望有所帮助。

#1


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.

更新实际上,您应该只需要使用wp_list_authors()来完成整个事情,因为它会自动生成一个作者列表,其中包含指向显示其所有帖子的页面的链接。有关详细信息,请参阅http://codex.wordpress.org/Template_Tags/wp_list_authors#Markup_and_Styling_of_Author_Lists。

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/

我正在使用这个插件来显示作者的帖子,它运作良好。 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.

我有一个author.php模板,显示作者的信息(pic,blurb),在它下面,我正在使用上面的插件显示他们最近的5个帖子。

To show the pic I'm using this plugin: http://wordpress.org/extend/plugins/user-photo/

要显示我正在使用此插件的图片:http://wordpress.org/extend/plugins/user-photo/

To get the dropdown contents you could use this wp function:

要获取下拉内容,您可以使用此wp函数:

<?php wp_list_authors(); ?>

#2


WordPress has now added a function to do this:

WordPress现在添加了一个函数来执行此操作:

<?php wp_dropdown_users( $args ); ?>

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

你只需要输入你的论点。如果你需要一个带有提交按钮的HTML表单的样本,那么这里有一个http://bit.ly/wWunIE

Hope that helps.

希望有所帮助。