Author Archive – Display author posts by category
I’m using the author.php to list generate author archives for a multi-author site. It’s for a radio station, and each DJ writes regular posts as well as play lists (both are in different categories). I would like to separate these two in the archive if possible. I imagine it’s in the loop, and I tried modifying it with a query, which worked to split the content, but it didn’t filter by author.
Here’s an example of my author.php file – if it helps at all.
<?php get_header(); ?> <?php get_sidebar(); ?> <div id="standard-container" class="narrowcolumn"> <!-- This sets the $curauth variable --> <?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($author_name); else : $curauth = get_userdata(intval($author)); endif; ?> <div class="postauthor"> <?php echo get_avatar( $curauth->ID , 80 ); ?> <h4>DJ: <span class="red"><?php echo $curauth->nickname; ?></span></h4> <strong>Show Title: </strong><?php echo $curauth->showtitle; ?> <br /> <strong>Show Hours: </strong><?php echo $curauth->showhours; ?> <br /> <strong>Music Type: </strong><?php echo $curauth->showtype; ?> <br /> <br /> <p><strong>Bio:</strong> <?php echo $curauth->user_description; ?></p> <h3>Posts by <?php echo $curauth->display_name; ?>:</h3> <ul> <!-- The Loop --> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <li> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"> <?php the_title(); ?></a>, <?php the_time('d M Y'); ?> in <?php the_category('&');?> </li> <?php endwhile; else: ?> <p><?php _e('No posts by this author.'); ?></p> <?php endif; ?> <!-- End Loop --> </ul> </div> <?php get_footer(); ?>
- The topic ‘Author Archive – Display author posts by category’ is closed to new replies.