How to display byline anywhere using a shortcode

This article applies only to the Premium version of the plugin, release 2.0.6 or higher.
Get premium version

Molongui Authorship Premium has an option to automatically update any byline displayed on your site so assigned authors are displayed instead of the name of the user who actually created the post. That functionality has some limitations when displaying multiple authors (it cannot link each author to his/her posts archive page) and it even might cause incompatibilities with third plugins.

To overcome those limitations and possible issues, the plugin has some template tags you can use to achieve a complete integration with your theme and plugins. Check out this article to know how to use them.

But if you do not have any coding skills or prefer not to touch any code, you have another option: use the shortcode the plugin provides to display the byline. This shortcode can be used anywhere, not just in the byline of a post.

The trivial shortcode will display the author(s) of the current post being displayed with link(s) to author(s) archive page. That would be useful to replace the default byline. Check the shortcode and its output below:

Editor input

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam hendrerit ante ac libero imperdiet blandit.
[molongui_byline]
Phasellus venenatis neque non leo imperdiet pellentesque. Suspendisse varius magna velit, in blandit justo pharetra vel. Vivamus vitae arcu tortor.

Frontend output

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam hendrerit ante ac libero imperdiet blandit.
Phasellus venenatis neque non leo imperdiet pellentesque. Suspendisse varius magna velit, in blandit justo pharetra vel. Vivamus vitae arcu tortor.

Examples

The shortcode mentioned above accepts several attributes that modify the shortcode’s output (see section Attributes at the end of this article to know all the available attributes and its usage). You might find that useful to change the styles of the displayed text or to show authorship information from other posts, for instance. See some examples below:

Byline with custom text

The shortcode below will display the names of the authors who wrote this article preceded by the “Written by” text:

Editor input

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam hendrerit ante ac libero imperdiet blandit.
[molongui_byline before='Written by ']
Phasellus venenatis neque non leo imperdiet pellentesque. Suspendisse varius magna velit, in blandit justo pharetra vel. Vivamus vitae arcu tortor.

Frontend output

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam hendrerit ante ac libero imperdiet blandit.
Written by James White and Noah Backer
Phasellus venenatis neque non leo imperdiet pellentesque. Suspendisse varius magna velit, in blandit justo pharetra vel. Vivamus vitae arcu tortor.

Byline without links to archive author pages

You can also disable links to archive pages, so plain text will be displayed:

Editor input

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam hendrerit ante ac libero imperdiet blandit.
[molongui_byline before='Written by ' linked='no']
Phasellus venenatis neque non leo imperdiet pellentesque. Suspendisse varius magna velit, in blandit justo pharetra vel. Vivamus vitae arcu tortor.

Frontend output

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam hendrerit ante ac libero imperdiet blandit.
Written by James White and Noah Backer
Phasellus venenatis neque non leo imperdiet pellentesque. Suspendisse varius magna velit, in blandit justo pharetra vel. Vivamus vitae arcu tortor.

Credit authors of a mentioned post

It might also be interesting for you to credit the authors of a post you are mentioning:

Editor input

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam hendrerit ante ac libero imperdiet blandit.
Check out this amazing post written by [molongui_byline pid='3003' linked='no']. You are gonna love it!
Phasellus venenatis neque non leo imperdiet pellentesque. Suspendisse varius magna velit, in blandit justo pharetra vel. Vivamus vitae arcu tortor.

Frontend output

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam hendrerit ante ac libero imperdiet blandit.
Check out this amazing post written by Claire Williams and Nick Goldman. You are gonna love it!
Phasellus venenatis neque non leo imperdiet pellentesque. Suspendisse varius magna velit, in blandit justo pharetra vel. Vivamus vitae arcu tortor.

Shortcode attributes

Check out below all the available attributes you can use to fully customize your byline:

pidoptional
Post ID whose author(s) will be displayed.
Accepts integer as post ID.
Defaults to current post ID.
Available since version 2.0.6.
separatoroptional
Delimiter that should appear between the authors.
Accepts plain text.
Defaults to comma.
Available since version 2.0.6.
last_separatoroptional
Delimiter that should appear between the last two authors.
Accepts plain text.
Defaults to and.
Available since version 2.0.6.
beforeoptional
Contents to add before author name(s).
Accepts plain text or HTML.
Available since version 2.0.6.
afteroptional
Contents to add after author name(s).
Accepts plain text or HTML.
Available since version 2.0.6.
linkedoptional
Whether to make author name(s) link to their author archive pages.
Defaults to yes.
Available since version 2.0.6.
Did this article answer your question?