Forums

post type author.php pagination problem (1 post)

  1. hugomcwilliams
    Member
    Posted 2 years ago #

    Hi guys,
    The standard code for the author template doesn't work for custom post types.
    This is the code I used to solve the problem:

    <?php if(isset($_GET['author_name'])) :$curauth = get_user_by('slug', $author_name);
    else :$curauth = get_userdata(intval($author));
    endif; ?>
    <?php $authorID = $curauth->ID; ?>
    <?php $post_types=get_post_types(); foreach ($post_types as $post_type ) {
    $query= 'author=' . $authorID. '&post_type=' . $post_type . '&orderby=post_date&order=desc';
    query_posts($query);
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <?php endwhile; else: endif;
    }
    wp_reset_query(); ?>

    However, I have tried to sort out pagination for this, but with no success. This is the code I have, but I am not sure how to combine it with the above.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('showposts=5'.'&paged='.$paged);

    Any suggestions greatly appreciated.
    Hugo

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by hugomcwilliams
  • This topic is not resolved
  • WordPress version: 3.0.4