Title: Custom Post Type Count?
Last modified: January 6, 2019

---

# Custom Post Type Count?

 *  [jtcheng](https://wordpress.org/support/users/jtcheng/)
 * (@jtcheng)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/custom-post-type-count/)
 * Hi,
 * I was wondering if it’s possible to do what this shortcode was doing (how you
   have it in the FAQ):
    [userlist orderby=”post_count” order=”DESC”]
 * except we display the descending list based on user-submitted posts (a custom
   post type) as opposed to the regular post type.
 * Thanks
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcustom-post-type-count%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/custom-post-type-count/#post-11058094)
 * This plugin supports only what is possible with WP_User_Query, see the [Codex ](https://codex.wordpress.org/Class_Reference/WP_User_Query#Pagination_Parameters)
   for full info. But it does appear that the `has_published_posts` parameter may
   be relevant, and is not included in SUL. I can’t do a full test on it now.
 * But something like this may help:
 * `[userlist number="5" query_id="product_authors"]`
 * And then manually add the product type support:
 *     ```
       function kia_filter_by_cpt( $args, $query_id ) {
           if( $query_id == 'product_authors' ) {
               $args['has_published_posts'] = array( 'product' );
           }
           return $args;
       }
       add_filter( 'sul_user_query_args', 'kia_filter_by_cpt', 10, 2 );
       ```
   
 * I don’t know if that will work exactly as you need, but it’s hopefully a start.
   I’ll try to add support for that eventually, but this is one of my free plugins
   and so I can’t prioritize work on it.
 * Cheers!
 *  Plugin Author [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * (@helgatheviking)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/custom-post-type-count/#post-11185573)
 * [@jtcheng](https://wordpress.org/support/users/jtcheng/) I’ve just added support
   for `has_published_posts` in a developmental version of the plugin here: [https://github.com/helgatheviking/Simple-User-Listing/tree/feature/loop](https://github.com/helgatheviking/Simple-User-Listing/tree/feature/loop)
 * Would you check it out and see if it works for you? The shortcode attribute value
   would be a comma-delimited list of post types.
 * `[userlist has_published_posts="custom-post-type,posts,products"]`
 * Keep in mind you would still need to customize the templates output to show a
   different count and a different link. but you can use the template attribute 
   to assign a unique template when displaying a directory based on a custom post
   type.
 * `[userlist has_published_posts="custom-post-type" template="custom-author"]`
 * And then instead of the `content-author.php` template, the plugin would load `
   content-custom-author.php` from your theme’s `simple-user-listing/` directory.
 * Also, remember this is a developmental version and you should test it extensively
   before using it in production. Please let me know if it works for you!
    -  This reply was modified 7 years, 4 months ago by [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/).

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom Post Type Count?’ is closed to new replies.

 * ![](https://ps.w.org/simple-user-listing/assets/icon-256x256.png?rev=3061308)
 * [Simple User Listing](https://wordpress.org/plugins/simple-user-listing/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-user-listing/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-user-listing/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-user-listing/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-user-listing/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-user-listing/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [HelgaTheViking](https://wordpress.org/support/users/helgatheviking/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/custom-post-type-count/#post-11185573)
 * Status: not resolved