• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

Genesis Users Page Template

This code creates a page template which you can use to display any users using any of the parameters included in the get_users function.

In this example, the code generates a list of all users who have published at least 1 post however you can change the parameters to anything you like.

users_template

Installation Instructions

Simply create a new file using a code editor like Notepad++ and add the following code to the file. Save the file as a PHP file.

Name the file anything you like, ( something like page_contributors.php ) and upload it to your child themes root directory.

Register for full access

Related Code

  • Genesis Contributors Page Template With Avatar & Twitter Link
  • Genesis Team Template With Schema Microdata

Reader Interactions

Comments

  1. Cathie says

    April 1, 2015 at 11:16 am

    Hi there Brad, thank you for sharing this. I’m trying to add a piece of code that it only finds contributors for a custom post type called ‘article’. To count only articles posted and not blog ‘posts’. Can you advise me on how to do this?
    I tried adding ‘post_type’ => ‘article’, to the $contributor_ids array but then got stuck as I don’t know much about customising like this.
    Thanks,
    Cathie.

    Log in to Reply
    • Brad Dalton says

      April 1, 2015 at 12:16 pm

      Hi Cathie

      1. There is no $post_type parameter for get_users or WP_User_Query so that won’t work.

      Should be added as an enhancement to the WordPress core.

      2. The good news is the code also includes a secondary function named count_users_posts which now supports post types since WordPress 4.1 was released.

      See this line in the template around line 17:

      $post_count = count_user_posts( $contributor_id );

      Simply add your post type as the second parameter by replacing $post_type with the name of your custom post type:

      $post_count = count_user_posts( $contributor_id, $post_type );

      This is what you will need:

      $post_count = count_user_posts( $contributor_id, 'article' );
      Log in to Reply
  2. thisisarp says

    February 20, 2015 at 2:11 pm

    Hi Brad,

    I’m trying to do this in a widget, basically to create a section on my home page. How can I modify the code to achieve that?

    I’m also wanting to show name (linked to author archive), avatar, bio and 3-4 images (which I’d like to add as custom profile fields). I can figure that out, though any tips or pitfalls to watch out for would be helpful.

    Log in to Reply
    • Brad Dalton says

      February 20, 2015 at 3:33 pm

      I don’t think the output would be any different in a widget but you could change the hook from genesis_entry_content

      Another option is to modify the genesis featured widgets query $args and use that as a users widget. http://wpsites.net/best-plugins/custom-genesis-featured-posts-widget-you-can-modify-safely/

      Log in to Reply
      • thisisarp says

        February 20, 2015 at 10:02 pm

        I could just take the function contributors_author_list and turn it into a shortcode and use that, no? (forgive me if that’s a dumb question :))

        Log in to Reply
        • Brad Dalton says

          February 20, 2015 at 10:25 pm

          Good idea of you want it within the content using the WP Editor.

          Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.