Dropdown List of Authors with Posts in Category – WordPress

WordPress Author Categories DropdownWhile at first it may seem impossible, creating a dropdown list of all the authors with posts in a specific category is not actually all that difficult. This will work with custom taxonomies and custom post types as well, so it should suit the needs of just about anyone. Let’s get right to it!

The Code:

 

There are 3 spots you are going to need to fill in the name of your custom taxonomy or custom post type, all noted with comments. Make sure you change these to reflect what you are trying to do. Once you have that set up, you can drop this into a template file to make it display. keep in mind, this code works with an existing query to generate the list. In other words, it really only works on a category results page. I recommend creating a template file based on category.php and naming it taxonomy-custom_taxonomy_name.php, adding this code, and saving it to your template directory. Change “custom_taxonomy_name” to the name of your custom taxonomy.

Tired of dealing with your slow WordPress website? Email me at brian@pagecrafter.com and mention the code #FreeHosting10 for two free months of lightning-fast WordPress hosting. We will even migrate you for free!

The page that users will be brought to is actually an archive page for all posts with the given term (category), filtered by author. In this example, the link that is used uses pretty permalinks, so it may not work if you aren’t using pretty permalinks. There’s really no reason to not be using them, however, and there’s no downside to changing your permalink structure site-wide.

That should be it! Let me know if you have any trouble with the code in the comments, or you can reach me on Twitter @brianjonline or email me at brian@brianjohnsondesign.com.

About Brian Johnson

Brian Johnson is a website developer and designer living in Minneapolis, Minnesota with a passion for code and WordPress. He spends his days building WordPress websites for small businesses, developing new code with the online community, and living life.