• 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

WP Authors Page Template With Social Media Links

This code is an extension of another post about how to create an author contributors page template.

The code adds extra user profile fields for social media links.

contact info

On top of this it uses the native Dashicons already included in WordPress.

Authors Template

Code Installation

There’s 3 blocks of code which need to be installed.

  1. Create a new file named contributors_page.php using a text editor like Notepad++ and copy the code under contributors_page.php into your new file. Save the file to desktop and upload to the root directory of your child theme.
  2. Copy the PHP code under functions.php and paste it at the end of your child themes functions.php file.
  3. Copy the CSS code under style.css and paste it at the end of your child themes style.css file before the start of your Media Queries section.
Update: This page template now only displays the social media icon if the field is populated. If not, it won’t display.

Register for full access

Note: The code lists all authors who are assigned the contributor role only & has been tested on the Genesis default theme. May need tweaking for use on other themes.

Related Posts

  • Genesis Contributors Page Template With Avatar & Twitter Link
  • Genesis Users Page Template

Reader Interactions

Comments

  1. thisisarp says

    February 21, 2015 at 9:14 pm

    OK – got this working as a shortcode, woot! One thing is bedeviling me – I want to randomize it rather than have it ordered by the number of posts. It doesn’t seem like get_users has an option to randomize the order (for either order or orderby). How can I do that?

    Also, even though I’m using it in a widget as a shortcode, the output is display above the widget title. I have no idea how that is happening.

    Log in to Reply
    • Brad Dalton says

      February 21, 2015 at 10:08 pm

      You could replace get_users with WP_User_Query but that doesn’t seem to include the standard WP_Query Order & Orderby Parameters either, not sure why so i’ll see if i can find out for you.

      Maybe you are returning it before returning the widget?

      Log in to Reply
      • thisisarp says

        February 22, 2015 at 12:47 pm

        I found a really simple way to randomize – before the foreach statement, I added this:

        shuffle( $contributor_ids );

        I found it by taking a look at the Author Avatars plugin to see how they did it. Maybe it’s an option you can add to your code 🙂

        On the shortcode being called before the widget, I’m not sure how that works – I’m still quite the noob.

        Log in to Reply
        • Brad Dalton says

          February 22, 2015 at 7:32 pm

          Cool.

          Haven’t seen that function before.

          Thanks for the great feedback.

          Log in to Reply
    • Brad Dalton says

      February 21, 2015 at 10:24 pm

      Try pre_get_posts as another function for RAND

      Log in to Reply
    • thisisarp says

      February 22, 2015 at 2:27 pm

      And …. because I’m using a shortcode where the function is not returning a string, I had to use output buffering to get the widget title to appear above the shortcode output. Plus I figured out how to limit the results to 1 random contributor. Now to figure out the last steps of creating a custom profile field to upload images and to display those images…

      Log in to Reply
  2. Josef Davies-Coates says

    July 9, 2014 at 12:15 pm

    This is great, thanks!

    However, the social icons appear whether or not the relevant fields have any date input into them, which is a bit a problem (not everyone has relevant social links).

    I’ve not added any links for into the relevant profile fields for the vast majority or those contributors, and yet the social icons are displaying for everyone
    Any idea how I can change/ fix this?

    Thanks!

    Log in to Reply
    • Brad Dalton says

      July 9, 2014 at 1:18 pm

      You will need to modify the code to get it to do exactly what you want.

      Log in to Reply
  3. Erica Mueller says

    June 27, 2014 at 7:20 pm

    Will this also be translated for Genesis? I noticed the page template code doesn’t look like the template code for a Genesis theme.

    Log in to Reply
    • Brad Dalton says

      June 28, 2014 at 2:26 am

      Hello Erica

      You can add translation if you like. http://codex.wordpress.org/Translating_WordPress

      There’s different ways to code templates.

      The reason i coded it this way is so it works with any theme.

      Log in to Reply
    • Brad Dalton says

      January 15, 2015 at 6:17 am

      Just wrote the code specifically for Genesis. Thanks for the idea Erica http://wpsites.net/web-design/genesis-users-page-template/

      Log in to Reply
  4. Davide says

    June 9, 2014 at 1:41 pm

    Thanks a lot for this useful tutorial and scripts.
    Accept only a little suggestion also for your follower… I found the email to add http:// before then in functions.php modify the following line:

    &lt;a class=&quot;contributor-email-link&quot; href=&quot;mailto:"&gt;</a>
    
    into the following:
    
    &lt;a class=&quot;contributor-email-link&quot; href=&quot;mailto:"&gt;</a>
    Log in to Reply
    • Brad Dalton says

      June 9, 2014 at 2:03 pm

      What is the difference?

      Log in to Reply
  5. mariedenee says

    April 24, 2014 at 12:43 am

    This is amazing. I however how two issues… all the links are defaulting to the site’s links or my links on my profile not theirs and in the array section, how do I edit out or edit in only certain contributors?

    Log in to Reply
    • Brad Dalton says

      April 24, 2014 at 1:19 am

      Code modifications are not provided for free.

      I would need to inspect and test your code to see where you went wrong with the installation.

      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.