I am a newbie on wordpress and php and I have my mind blowing because I am trying to find a way to compile this code that I found here...
<?php 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 = 'post' AND post_status = 'publish'"); ?> <h2>Post Count: <?php echo $post_count; ?></h2>
My goal is to show the count of published posts foreach custom post_type in author.php and I found a way to do it but this is not the right way. You can see my code here http://pastebin.com/6cSxs4th.
How can I compile this?