Introduction I expected wordpress to have some built in support for listing all authors of the blog in a select box but that is not the case yet in Wordpress 2.9.2. I was certain that I can get this done using wp_list_authors but actually it was a not that straight forward and so let me share this with you. I think this will help those looking for such functionality. The Code What I did is replaced the content of list items ( <li> ) into select box options ( <option> ) and added a JavaScript function to redirect user to the url when there is a change in the selection in the selection box. So here is the code. Code: <select id="AuthorList" name="AuthorList" onchange="goAuthorList();"> <?php $authargs = array( 'optioncount' => false, 'exclude_admin' => false, 'show_fullname' => false, 'hide_empty' => true, 'echo' => false, // We will not output using the function. 'feed' => false, 'feed_image' => false, 'style' => 'list', 'html' => true ); $var_list = wp_list_authors( $authargs ); // Take the output into a variable. // Replace the tags of list to option box $var_list = str_replace("</a></li>","</option>",$var_list); $var_list = str_replace("<li><a href=","<option value=",$var_list); // Now output the list echo $var_list; ?> </select> <script language="JavaScript"> <!-- function goAuthorList() { // JavaScript function to change the user to the url of the author theSelAuthor = document.getElementById("AuthorList").value; if ("" != theSelAuthor) location.href = theSelAuthor; } //--> </script> Enjoy !!!
Thank you! Since I am a beginner to WordPress, the code was really helpful for me to add an Author's Info in to Box