How to list categories by author?
My site will have multiple authors posting in the same set of categories. What I would like to do is when I show an author’s archive, there will be a list of categories in the sidebar for that author. Clicking on a category would then only show the posts of that particular author in that particular category. Obviously, categories where the author hasn’t posted anything won’t be listed.
Is this possible? I can’t find any switches or options in wp_list_cats or list_cats. Or, is there any plugin that can do this?
You will have to do some self-tailoring to achieve this. WordPress is unlikely to incorporate such an option because there will be mere demand for it.
I am not aware of any plug-ins that achieve this. As it’s been 18 hours since your original post, I thought it’s worth making a followup that’s not very productive. Enjoy your holiday.
I am looking for a such plugin either.
I’ve found that the Level Ten Blog Matrix plugin can do this: http://www.leveltendesign.com/blog/blogs/wordpress/plugins/blog_matrix
wordpress is pretty flexible, actually. if you want to learn more about customizing wordpress and hone your skills, you can also do this without a plugin.
for example, you can create a custom category template, and give query_posts a variable of an author id, via a URL query string. (nb: you’d have to create a custom template for each new category)
ohh… you could also create a custom author template, and give query_posts a category to deliver. that would be good too.
since i have this handy, here’s an basic example of how you’d do it with custom category templates.
1- create a custom category-x.php file in your theme folder. in this case i’m doing the default category-1.php
this is a basic one that works with WP default theme:
<?php get_header(); ?>
$thisauthor = $_GET['author'];
<?php query_posts("author=$thisauthor") ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else : ?>
<p>No posts by that author</p>
<?php endif; ?>
<?php get_footer(); ?>
2- then, create links to this page (URL query string) and send it the variable of the author ID. i use permalinks and make links like this:
you can make these links using the list authors functionality.
references in the Codex:
- The topic ‘How to list categories by author?’ is closed to new replies.