WordPress.org

Ready to get started?Download WordPress

Forums

Getting Authors Posts To Show Up On A Page Template (2 posts)

  1. bluntrizzle
    Member
    Posted 5 years ago #

    Hi there. I have wordpress "pages" set up that act like a profile for the author. There are quite a few authors. What I would like to do is display all the posts by this author in a loop form so I can call certain parts of the post in the loop. Is this possible to do from inside the page.php template after the original loop displaying the profile information.

    Also if all the posts are called, is it possible to paginate the posts.

    Thanks in advance

  2. bluntrizzle
    Member
    Posted 5 years ago #

    So after a bit of playing around and referencing I am using this code exmaple:-

    <?php
    			$currentauthor = the_author();
    			$my_query = new WP_Query('author_name=[currentauthor]&showposts=10');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;?>
        <?php the_title(); ?>
      <?php endwhile; ?>
        <!-- Do other stuff... -->
      <?php if (have_posts()) : while (have_posts()) : the_post();
      if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
       <!-- Do stuff... -->
      <?php endwhile; endif; ?>

    Is it possible for the author_name in wp_query to be the automatic author name of the page? I want it to be automatic so I don't have to make an new page template for every single author and just change the author name in the wp query.

    Thanks in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic