Support » Fixing WordPress » 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 -->
    if(isset($_GET['author_name'])) :
    $curauth = get_userdatabylogin($author_name);
    else :
    $curauth = get_userdata(intval($author));
    <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>
    <!-- The Loop -->
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                <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('&');?>
        <?php endwhile; else: ?>
            <p><?php _e('No posts by this author.'); ?></p>
        <?php endif; ?>
    <!-- End Loop -->
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Author Archive – Display author posts by category’ is closed to new replies.