WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
global $wp_query;    
$curauth = $wp_query->get_queried_object();    
$post_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '" . $curauth->ID . "' AND post_type =     photoshop_tutorial' AND post_status = 'publish'");    

<p>Post Count: <?php echo $post_count; ?></p>

I've tried with this codes & it shows the whole photoshop_tutorial posts count, but what I want is to display for individual author's posts, because I want to add it in author page.

For example:

Smith posted <?php $post_count; ?> photoshop tutorials

How can I do that?

share|improve this question

Did you tried fetching the requested posts with WP_Query?

$posts = new WP_Query();
$posts->query( array(
    'posts_per_page' => -1,
    'author' => $curauth->ID,
    'post_type' => 'photoshop_tutorial'
) );

$post_count = sizeof( $posts->posts );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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