1. <?php
  2. //first post_type
  3. global $wp_query;
  4. $curauth = $wp_query->get_queried_object();
  5. $post_count_emp = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '" . $curauth->ID . "' AND post_type = 'listing' AND post_status = 'publish'");
  6. ?>
  7. <?php
  8. //second post_type
  9. global $wp_query;
  10. $curauth = $wp_query->get_queried_object();
  11. $post_count_pos = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '" . $curauth->ID . "' AND post_type = 'post' AND post_status = 'publish'");
  12. ?>
  13. <?php
  14. //third post_type
  15. global $wp_query;
  16. $curauth = $wp_query->get_queried_object();
  17. $post_count_ques = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '" . $curauth->ID . "' AND post_type = 'question' AND post_status = 'publish'");
  18. ?>
  19.  
  20. <h2>The Author published:</h2>
  21. <ul>
  22. <li> <?php echo $post_count_emp; ?> Listing (s) </li>
  23. <li> <?php echo $post_count_pos; ?> Post (s) </li>
  24. <li> <?php echo $post_count_ques; ?> Question (s) </li>
  25. </ul>