Skip to main content

Shortcode Usage

Display authors anywhere on your site using powerful shortcodes. No PHP knowledge required!

Available Shortcodes​

ThemeRuby Multi Authors provides 5 shortcodes for different display needs:

ShortcodePurposeOutput
[ema_authors]Simple author listNames with links
[ema_author_box]Complete author boxAvatars, bios, links
[ema_author_list]Unordered listStructured list with optional avatars
[ema_author_avatars]Avatar display onlyJust the profile pictures
[ema_author_count]Author countNumber of authors

[ema_authors]​

Display a simple formatted list of author names.

Basic Usage​

[ema_authors]

Output:

John Doe, Jane Smith, Bob Johnson

With Custom Separator​

[ema_authors separator=" & "]

Output:

John Doe & Jane Smith & Bob Johnson

With Before/After Text​

[ema_authors before="Written by: " after=" - Thank you!"]

Output:

Written by: John Doe, Jane Smith - Thank you!
[ema_authors link="false"]

Output:

John Doe, Jane Smith, Bob Johnson
(Plain text, no links)

For Specific Post​

[ema_authors post_id="123"]

All Parameters​

ParameterTypeDefaultDescription
post_idintCurrent postPost ID to get authors from
separatorstring, Text between author names
linkbooltrueLink authors to their archives
beforestring``HTML before the author list
afterstring``HTML after the author list

Complete Examples​

Inline with text:

This article was written by [ema_authors separator=" and "].

Custom styling:

[ema_authors before='<div class="post-byline">By ' after='</div>' separator=" & "]

[ema_author_box]​

Display a complete author box with avatars, bios, and links.

Basic Usage​

[ema_author_box]

Output:

┌─────────────────────────────────┐
│ About the Authors │
│ │
│ [Avatar] John Doe │
│ Web developer and writer │
│ View all posts → │
│ │
│ [Avatar] Jane Smith │
│ Content editor and strategist │
│ View all posts → │
└─────────────────────────────────┘

Without Avatars​

[ema_author_box show_avatar="false"]

Without Bios​

[ema_author_box show_bio="false"]

Custom Avatar Size​

[ema_author_box avatar_size="100"]

For Specific Post​

[ema_author_box post_id="123"]

All Parameters​

ParameterTypeDefaultDescription
post_idintCurrent postPost ID to get authors from
show_avatarbooltrueDisplay author avatars
show_biobooltrueDisplay author bios
avatar_sizeint80Avatar size in pixels

Complete Examples​

Minimal box:

[ema_author_box show_avatar="false" show_bio="false"]

Large avatars with bios:

[ema_author_box avatar_size="120"]

In sidebar widget:

[ema_author_box show_bio="false" avatar_size="48"]

[ema_author_list]​

Display authors as a structured unordered list.

Basic Usage​

[ema_author_list]

Output:

• John Doe
• Jane Smith
• Bob Johnson

With Avatars​

[ema_author_list show_avatar="true"]

Output:

• [Avatar] John Doe
• [Avatar] Jane Smith
• [Avatar] Bob Johnson

With Post Count​

[ema_author_list show_count="true"]

Output:

• John Doe (42 posts)
• Jane Smith (28 posts)
• Bob Johnson (15 posts)

With Both Avatars and Count​

[ema_author_list show_avatar="true" show_count="true" avatar_size="32"]

All Parameters​

ParameterTypeDefaultDescription
post_idintCurrent postPost ID to get authors from
show_avatarboolfalseDisplay author avatars
show_countboolfalseShow post count for each author
avatar_sizeint32Avatar size in pixels

Complete Examples​

Full featured list:

[ema_author_list show_avatar="true" show_count="true"]

Names only:

[ema_author_list]

[ema_author_avatars]​

Display only author profile pictures.

Basic Usage​

[ema_author_avatars]

Output:

[Avatar] [Avatar] [Avatar]

Larger Avatars​

[ema_author_avatars size="80"]
[ema_author_avatars link="false"]

For Specific Post​

[ema_author_avatars post_id="123" size="60"]

All Parameters​

ParameterTypeDefaultDescription
post_idintCurrent postPost ID to get authors from
sizeint48Avatar size in pixels
linkbooltrueLink avatars to author archives

Complete Examples​

Large linked avatars:

[ema_author_avatars size="80"]

Small avatar row:

[ema_author_avatars size="32" link="false"]

Custom post avatars:

[ema_author_avatars post_id="456" size="100"]

[ema_author_count]​

Display the number of authors for a post.

Basic Usage​

[ema_author_count]

Output:

3 authors

Custom Text​

[ema_author_count text="Written by %d people"]

Output:

Written by 3 people

For Specific Post​

[ema_author_count post_id="123"]

All Parameters​

ParameterTypeDefaultDescription
post_idintCurrent postPost ID to get authors from
textstringAutoCustom text with %d placeholder for count

Complete Examples​

In sentence:

This article has [ema_author_count] contributing to it.

Custom message:

[ema_author_count text="Collaboration between %d writers"]

Specific post:

[ema_author_count post_id="789" text="%d co-authors"]

Combining Shortcodes​

You can use multiple shortcodes together:

<div class="post-meta">
<strong>Authors:</strong> [ema_authors separator=" & "]
<br>
<strong>Contributors:</strong> [ema_author_count]
</div>

[ema_author_box]

In Page Builders​

Elementor​

  1. Add Text Editor widget
  2. Switch to Text mode
  3. Paste shortcode
  4. Preview

Gutenberg Block Editor​

  1. Add Shortcode block
  2. Paste shortcode
  3. Preview in frontend

Classic Editor​

  1. Switch to Text mode
  2. Paste shortcode where needed
  3. Switch back to Visual mode

Widgets​

  1. Go to Appearance > Widgets
  2. Add Text or HTML widget
  3. Paste shortcode
  4. Save

Styling Shortcodes​

With Custom CSS​

Add to your theme's style.css:

/* Style author links */
.ema-author-link {
color: #e74c3c;
font-weight: bold;
}

.ema-author-link:hover {
text-decoration: underline;
}

/* Style author avatars */
.ema-author-avatars {
text-align: center;
margin: 20px 0;
}

.ema-author-avatar-item img {
border: 3px solid #3498db;
}

/* Style author list */
.ema-author-list {
background: #f8f9fa;
padding: 20px;
border-radius: 8px;
}

.ema-author-list-item {
font-size: 16px;
padding: 12px 0;
}

/* Style author count */
.ema-author-count {
background: #3498db;
color: white;
padding: 8px 16px;
border-radius: 20px;
}

/* Style author box from shortcode */
.ema-shortcode-box {
background: #fff;
border: 2px solid #e0e0e0;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

Inline Styles​

<div style="background: #f5f5f5; padding: 20px; border-radius: 8px;">
[ema_authors before="<strong>By:</strong> "]
</div>

Use Cases​

Article Byline​

<div class="article-byline">
By [ema_authors separator=" & "] | [ema_author_count text="%d contributors"]
</div>
<div class="author-widget">
<h4>Written By</h4>
[ema_author_list show_avatar="true"]
</div>
<div class="article-footer">
[ema_author_box show_bio="false" avatar_size="60"]
</div>

Team Page​

<h2>Our Authors</h2>
[ema_author_avatars size="100"]

<h3>Meet the Team</h3>
[ema_author_box]

Quick Author Info​

[ema_author_avatars size="32"] [ema_authors separator=", "]

Conditional Display​

While shortcodes don't support conditions directly, you can use them in templates:

<?php if ( tmauthors_has_multiple_authors() ) : ?>
<div class="multiple-authors">
<h4>This is a collaborative post by:</h4>
<?php echo do_shortcode( '[ema_author_list show_avatar="true"]' ); ?>
</div>
<?php else : ?>
<div class="single-author">
By <?php echo do_shortcode( '[ema_authors]' ); ?>
</div>
<?php endif; ?>

Troubleshooting​

Shortcode Not Working​

Check:

  1. Plugin is activated
  2. Shortcode spelling is correct
  3. You're using the correct shortcode block/widget
  4. Try with default attributes first

Styling Issues​

Solutions:

  1. Clear browser cache
  2. Check for CSS conflicts
  3. Use browser inspector to check applied styles
  4. Add !important to your custom CSS if needed

Not Showing on Page​

Possible causes:

  1. Post has no authors assigned
  2. Invalid post_id parameter
  3. Shortcode in wrong location

Test:

[ema_author_count]

If this shows "0 authors" or nothing, check author assignments.


Advanced Usage​

In Custom Templates​

// In your theme's template file
echo do_shortcode( '[ema_author_box]' );

Dynamic Post ID​

<?php
$current_id = get_the_ID();
echo do_shortcode( "[ema_authors post_id='{$current_id}']" );
?>

With Filters​

add_filter( 'ema_authors_shortcode_output', 'customize_author_output', 10, 3 );

function customize_author_output( $output, $authors, $atts ) {
// Add wrapper
return '<div class="my-custom-authors">' . $output . '</div>';
}

Best Practices​

  1. Use Appropriate Shortcode - Choose the right shortcode for your needs
  2. Test First - Try shortcodes with default settings before customizing
  3. Keep it Simple - Don't over-customize; use CSS for styling
  4. Cache Friendly - Shortcodes work great with caching plugins
  5. Mobile Responsive - Test on different screen sizes

Next Steps​