Title: Shortcode Solution
Last modified: August 24, 2016

---

# Shortcode Solution

 *  [msumner](https://wordpress.org/support/users/msumner/)
 * (@msumner)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/shortcode-solution/)
 * I needed to be able to drop multiple author boxes onto a single page to show 
   all the site’s authors. I like the look of this plugin, but it didn’t come with
   this functionality. I wanted to share how I did it in case anyone wants to do
   it.
 * **Please note:** if you upgrade the plugin you need to repeat the first step,
   unless the plugin author is willing to add this code to the core since it wouldn’t
   break any of the existing functionality.
 * **Step 1: Modify /core/sabox_author_box.php**
 * Change the function from this:
    `function wpsabox_author_box( $saboxmeta = null){`
 * To this:
    `function wpsabox_author_box( $saboxmeta = null, $authorid = NULL ){`
 * And on the next line change this:
    `if ( is_single() or is_author() or is_archive()){`
 * To this:
    `if ( is_single() or is_author() or is_archive() or (is_page() and 
   $authorid != NULL) ) {`
 * Then three more lines down change this:
    `$author_id = $post->post_author;`
 * To this:
    `$author_id = ($authorid == NULL) ? $post->post_author : $authorid;`
 * **Step 2: Create a shortcode in your theme’s functions.php**
 *     ```
       if(function_exists('add_shortcode') && function_exists('wpsabox_author_box')){
       	function sabox_shortcode($atts){
       		extract(shortcode_atts(array(
       			'id' => NULL,
       		), $atts));
   
       		ob_start();
       		echo wpsabox_author_box(NULL, $id);
       		$output = ob_get_contents();
       		ob_end_clean();
       		return $output;
       	}
   
       	add_shortcode('authorimg', 'sabox_shortcode');
       }
       ```
   
 * **Usage: Place the shortcode in a post or page**
 * [authorimg id=”THEAUTHORID”]
 * Replace THEAUTHORID with the WordPress user ID of the author. So if your author
   has an id of 8, it would look like this:
 * [authorimg id=”8″]
 * You can place as many as you want on a page or post.
 * **To the plugin author:** would you mind making my changes to /core/sabox_author_box.
   php since it doesn’t affect existing functionality and will allow people who 
   use this hack to update the plugin? Thanks.
 * [https://wordpress.org/plugins/simple-author-box/](https://wordpress.org/plugins/simple-author-box/)

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

 *  [dcogen](https://wordpress.org/support/users/dcogen/)
 * (@dcogen)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/shortcode-solution/#post-6176953)
 * Thanks for this, msumner!
 * Was looking for exactly this.
 * Only issue is that, while it does grab the correct author, image, and description,
   the social links are all the same (pointing to the person who created the page
   I believe). See what I mean here: [http://theunlockr.com/about/](http://theunlockr.com/about/)
 * Any fix by any chance?
 *  [dcogen](https://wordpress.org/support/users/dcogen/)
 * (@dcogen)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/shortcode-solution/#post-6176954)
 * Nevermind, fixed it.
 * I replaced this line under “// author box social icons” in the same file:
 * `$sabox_author_fields = get_the_author_meta( $sabox_social_id );`
 * with this:
 * `$sabox_author_fields = get_the_author_meta( $sabox_social_id, $author_id );`
 * Thanks again and hope that helps others with the issue.
 * Second that on adding this all into the plugin files itself if the author doesn’t
   mind.
 *  [cyberlp23](https://wordpress.org/support/users/cyberlp23/)
 * (@cyberlp23)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/shortcode-solution/#post-6177003)
 * Thanks for this!
    How would you do to create a shortcode to display the social
   icons of [author ID], and nothing more?

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

The topic ‘Shortcode Solution’ is closed to new replies.

 * ![](https://ps.w.org/simple-author-box/assets/icon-128x128.jpg?rev=1821054)
 * [Simple Author Box](https://wordpress.org/plugins/simple-author-box/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-author-box/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-author-box/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-author-box/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-author-box/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-author-box/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 3 replies
 * 3 participants
 * Last reply from: [cyberlp23](https://wordpress.org/support/users/cyberlp23/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/shortcode-solution/#post-6177003)
 * Status: not resolved