Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //first post_type
- global $wp_query;
- $curauth = $wp_query->get_queried_object();
- $post_count_emp = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '" . $curauth->ID . "' AND post_type = 'listing' AND post_status = 'publish'");
- ?>
- <?php
- //second post_type
- global $wp_query;
- $curauth = $wp_query->get_queried_object();
- $post_count_pos = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '" . $curauth->ID . "' AND post_type = 'post' AND post_status = 'publish'");
- ?>
- <?php
- //third post_type
- global $wp_query;
- $curauth = $wp_query->get_queried_object();
- $post_count_ques = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '" . $curauth->ID . "' AND post_type = 'question' AND post_status = 'publish'");
- ?>
- <h2>The Author published:</h2>
- <ul>
- <li> <?php echo $post_count_emp; ?> Listing (s) </li>
- <li> <?php echo $post_count_pos; ?> Post (s) </li>
- <li> <?php echo $post_count_ques; ?> Question (s) </li>
- </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement