WP Biographia 4) Shortcode Usage And Support

WP Biographia supports a single shortcode, [wp_biographia]. Adding this shortcode to the content of a post or page or into a theme template as content, expands the shortcode and replaces it with a Biography Box.

The shortcode also supports multiple attributes which allow you to customise the way in which the shortcode is expanded into the Biography Box:

  • the mode attribute
  • the user attribute
  • the author attribute (deprecated)
  • the role attribute
  • the order attribute
  • the prefix attribute
  • the name attribute
  • the type attribute

The “mode” Attribute

In raw mode, which is the default (specified as [wp_biographia mode="raw"] or simply as [wp_biographia]), the plugin inserts the Biography Box in you’ve asked for it, you’ve got it mode.

Or to put it another way, the plugin will honour the settings that you specify under Dashboard / Settings/ WP Biographia for Biography Box Style Settings and for Biography Box Content Settings but will ignore the Biography Box Display Settings and Biography Box Per User Settings.

In configured mode, specified as [wp_biographia mode="configured"], the plugin inserts the Biography Box and will honour all the settings under Dashboard / Settings / WP Biographia with the exception of Display On Front Page, Display On Individual Post, Display On Post Archives and Display On Individual Pages, as well as their equivalents for any custom post types you may have created.

The thinking behind this is that you probably want to honour post or page exclusions and per user exclusions, but by using the shortcode in your posts, you want to be in control of how and where the Biography Box is displayed.

The “user” Attribute

If the user attribute is omitted, which is the default, the shortcode assumes it’s being used within the WordPress Loop and will display the Biography Box once for the current post’s, page’s or custom post type’s user.

Specifying a user’s login name as the user attribute overrides this behaviour and allows multi-user sites to use the plugin to create a contributors page, where you use the shortcode as [wp_biographia user="login-name"] once for each of your site’s user that you want to appear, replacing "login-name" with a valid login name for one of your authors.

You call also use the user attribute in wildcard mode, specifying the user’s login name as * as [wp_biographia user="*"]; this will then loop over all of the user that have logins on your site, displaying the Biography Box once for each user, ordered alphabetically by login name.

Specifying an invalid login name ([wp_biographia user="idontexist"]) will result in no Biography Box being displayed. Specifying an empty login name ([wp_biographia user=""]) will cause the author attribute to be ignored and may result in undefined behaviour, such as a partially populated Biography Box being displayed as the shortcode is being used outside of the Loop and thus no author information is made available to the plugin by WordPress.

The “author” Attribute

The author attribute is now deprecated in favour of the user attribute introduced in v3.2.0 of the plugin. If the author attribute is used and no user attribute is present, the author attribute will act in the same way as the user attribute, described above. If both the user and author attributes are present, the author attribute will be ignored in favour of the user attribute.

In other words, if you use the shortcode and supply both the author and user attributes, such as , the Biography Box will be displayed for the user bar, not the user foo. Likewise, [wp_biographia user="*" author="foo"] will display the Biography Box in wildcard mode, not for the user foo.

Support for the author attribute will be likely be removed in a future release of the plugin to avoid confusion over the author and user attributes.

The “role” Attribute

Valid only when used in conjunction with the user attribute in wildcard mode, the role attribute allows you to filter the users that have user accounts on your blog according to their WordPress Role. The role attribute takes one or more comma separated arguments which define the WordPress role(s); at the time of writing, these can be one of:

  • administrator
  • editor
  • author
  • contributor
  • subscriber

For example, if you want to display the Biography Box for all users of your blog who have a role of author you can use the role attribute plus the author attribute in wildcard mode to do this, along the lines of [wp_biographia user="*" role="author"]. If you want to display the Biography Box for all users with a role of author or contributor, you can specify both roles, along the lines of [wp_biographia user="*" role="author,contributor"].

Specifying an invalid role ([wp_biographia user="*" role="foo"]) will result in no Biography Box being displayed. Specifying the role attribute without the author attribute in wildcard mode will have no effect.

The “order” Attribute

Valid only when used in conjunction with the user attribute in wildcard mode, the order attribute allows you to specify the display order for the users that have user accounts on your blog. The order attribute takes a single argument which defines the sorting order; at the time of writing, this can be one of:

  • account-name (the default)
  • first-name
  • last-name
  • nickname
  • display-name
  • login-id

For example, if you want to display the Biography Box for all users of your blog ordered according to their last name you can use the order attribute plus the author attribute in wildcard mode to do this, along the lines of [wp_biographia user="*" order="last-name"].

Specifying an invalid role ([wp_biographia user="*" order="foo"]) will result in the default account name sort order being used. Specifying the order attribute without the user attribute in wildcard mode will have no effect.

It’s important to note that the in order to successfully sort by first-name or by last-name, the First Name and/or Last Name fields must be populated in each user’s Profile; by default, these fields are not populated during the creation of a user’s WordPress account. The sorting of the user accounts when the order attribute is specified uses natural order string comparison, which means than an empty First Name or Last Name will appear before a First Name or Last Name which actually contains a value. If your WordPress site doesn’t have these name fields populated in your user’s Profiles, you may not see the sorting results you expect.

The “prefix” Attribute

If the prefix attribute is omitted, which is the default, the Biography Box will be displayed with Biography Prefix text configured in Settings/ WP Biographia / Biography Box Content Settings before the author’s name. This can be overridden by using the prefix attribute, along the lines of [wp_biographia prefix="All About"].

The “name” Attribute

If the name attribute is omitted, which is the default, the Biography Box will be displayed with the author’s name as configured by Author’s Name in Settings / WP Biographia /Biography Box Content Settings. This can be overriden by supplying one of the following for the name attribute’s argument:

  • account-name
  • first-last-name
  • nickname
  • display-name
  • none

The “type” Attribute

If the type attribute is omitted, which is the default, the Biography Box will be displayed with the user’s full biography text, taken from the Biographical Info field in the user’s profile. If the type attribute is specified with a value of full, this is equivalent to the default behaviour. If the type attribute is specified with a value of excerpt, the Biographical Excerpt field in the user’s profile will be used instead, providing the user has filled out this field in their profile. Specifying an invalid type attribute value ([wp_biographia type="foo"]) will result in the default behaviour of the full biography being used.