Support » Fixing WordPress » Authors page for custom post type

  • adambundy


    I’m trying to create a simple authors page restricted to a specific post type. I would like to display each author, some of their basic meta data, and links to the posts of the specified type credited to them (X most recent if possible). Any help is much appreciated. Thanks!

Viewing 1 replies (of 1 total)
  • Hi there – I noticed you published a solution to this – although I’ve tried implementing it and it seems to cause problems with pagination for me.

    I’ve used the usual query_posts pagination fix and adapted your code like this:

    $authors = $wpdb->get_results("SELECT ID
    FROM $wpdb->users
    (SELECT post_author
    FROM $wpdb->posts
    WHERE $wpdb->users.ID = $wpdb->posts.post_author
    AND $wpdb->posts.post_status = 'publish'
    AND $wpdb->posts.post_type = 'blog')
    ORDER BY display_name");
    foreach($authors as $author) {
    	$curauth = get_userdata(intval($author->ID));
    <h2>Author Profile for <span style="color:#560000;"><?php echo $curauth->first_name; ?> <?php echo $curauth->last_name; ?></span></h2>
    <p><?php echo $curauth->user_description; ?></p>
    <div style="height:8px;"></div>
    <h2 style="font-size:15pt;"><?php echo $curauth->first_name; ?>’s Posts</h2>
        <!-- Posts Loop -->
    <?php if (have_posts()) : ?>
         <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("post_type=any&paged=$paged&author=$author->ID&orderby=date&showposts=2"); while (have_posts()) : the_post(); ?>
    <div style="padding-left:20px; padding-right:20px;">
    <div id="smallerheaders"><h2><?php the_title(); ?></h2></div>
    <?php the_content(__('(Click for more...)')); ?></div>
    <div id="nextentry"></div>
    <?php endwhile; else: ?>
    <p><?php _e('No posts by this author.'); ?></p>
    <?php endif; ?>
    <?php } ?>
    <div class="clear"></div>
    <div style="width:400px; padding-left:20px; padding-bottom:20px; margin-top:1px; overflow:hidden; font-size:10pt; font-family:Georgia;"><?php wp_pagenavi(); ?></div>
    <?php wp_reset_query(); ?>
    <?php get_footer(); ?>

    But it still seems to cause me trouble (the second page and any after that just create a 404).

Viewing 1 replies (of 1 total)
  • The topic ‘Authors page for custom post type’ is closed to new replies.