I have a blog that publish articles of any philosophers.Each philosopher has a special page that includes information about him.

I've created a post type called philosopher. I want to display the title of each philosopher's articles under his page, but because every philosopher has many articles, I only want to display 10 articles and show the other articles on another page.


2 Answers 2


You can simply use the default author.php page to do this. If you don't have one, make a copy of index.php and rename it author.php

Now, use pre_get_posts to include your custom post type in the author pages. This code goes in functions.php

function cpt_on_author_page( $query ) {
    if ( !is_admin() && $query->is_author() && $query->is_main_query() ) {
        $query->set( 'post_type', array( 'post', 'philosopher' ) );
        $query->set( 'posts_per_page', 10 );
add_action( 'pre_get_posts', 'cpt_on_author_page' );
  • Please leave feedback. This question remains open. Did any of the answers solve your issue? If so, accept the appropriate answer by clicking on the check mark next to it. Thank you Mar 1, 2015 at 14:09

paste this code in a template

//if a certain page, then display posts authored by the logged in user
$page_title = 'Contributors Page';
if ( is_user_logged_in()  && is_page($page_title) ) {
  global $current_user;
  echo 'User ID: ' . $current_user->ID . "\n";
    'author' => $current_user->ID,
    'post_type' => 'post',
    'post_status' => 'publish, private',
    'posts_per_page' => -1,
    'caller_get_posts'=> 1
  $my_query = null;
  $my_query = new WP_Query($args);
  if( $my_query->have_posts() ) {
    echo 'Your Posts';
    while ($my_query->have_posts()) : $my_query->the_post(); ?>
      <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
  wp_reset_query();  // Restore global post data stomped by the_post().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.