WordPress shortcode

Position your BeyondWords Player anywhere on the page using our WordPress shortcode.

A shortcode is a WordPress-specific code that lets you do nifty things with very little effort. Shortcodes can embed files or create objects that would normally require lots of complicated, ugly code in just one line. Shortcode = shortcut.

https://wordpress.org/documentation/article/shortcode-block/

By default our BeyondWords Player is automatically prepended to the body content of each post or page. If our shortcode is detected anywhere in the WordPress content (the_content) then we prevent the automatic prepending of our default player and instead display the BeyondWords Player where you have placed the shortcode.

Using our shortcode

Block Editor

Add the shortcode [beyondwords_player] into a shortcode block to define a custom location for the audio player in the WordPress Block Editor.

Classic Editor

For the WordPress Classic Editor, type the[beyondwords_player] shortcode anywhere in your WordPress content. For example:

Content before player.

[beyondwords_player]

Content after player.

PHP

The WordPress do_shortcode function can be used to output a player in PHP.

<p>Content before player.</p>
<?php echo do_shortcode( '[beyondwords_player]' ); ?>
<p>Content after player.</p>

Our shortcode will only function whilst running inside The Loop, because each BeyondWords Player needs to access the audio data we store in the beyondwords_content_id and beyondwords_project_id custom fields.

If you would like to display BeyondWords Players outside of the The Loop then please email the details of your use case to [email protected].

Last updated