WordPress.org

Ready to get started?Download WordPress

Forums

Author Archive - Display author posts by category (2 posts)

  1. Dan Hannigan
    Member
    Posted 3 years ago #

    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(); ?>
  2. Grievy
    Member
    Posted 3 years ago #

    Did you manage to find a solution to this as I am trying to achieve the same thing?

Topic Closed

This topic has been closed to new replies.

About this Topic