Embed Lottie Player Shortcode

Below, you’ll find a detailed guide on how to add the Embed Lottie Player Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Embed Lottie Player Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Embed Lottie Player Plugin and the shortcodes it provides:

Plugin Icon
Lottie Player block – Implement Lottie animations.

"Lottie Player Block is a WordPress plugin designed to seamlessly integrate Lottie animations into your pages. Its slug is 'embed-lottie-player'."

★★★★★ (4) Active Installs: 4000+ Tested with: 6.3.2 PHP Version: 7.1
Included Shortcodes:
  • [lpb]

Embed Lottie Player [lpb] Shortcode

The Embed-Lottie-Player shortcode, ‘lpb’, extracts and renders the first block of a specified post. This is achieved by parsing the post content and returning the rendered block. .

Shortcode: [lpb]


Here is a list of all possible lpb shortcode parameters and attributes:

  • id – Specifies the unique identifier of the post

Examples and Usage

Basic example – The following shortcode example represents a basic usage of the lottie player plugin. The shortcode ‘lpb’ is used with the attribute ‘id’ to reference a specific post. This will render the first block of the post with the given id.

[lpb id=1 /]

Advanced examples

The following shortcode provides a more advanced usage of the lottie player plugin. In this example, the shortcode ‘lpb’ is used with two attributes ‘id’ and ‘block’. The ‘id’ attribute is used to reference a specific post, while the ‘block’ attribute is used to render a specific block within the post. If the block with the given index does not exist, the shortcode will return an empty string.

[lpb id=1 block=2 /]

Another advanced example includes the use of the ‘lpb’ shortcode with the ‘id’ and ‘title’ attributes. This example attempts to load a post by its ‘id’ first, but if a post with the given id is not found, it will try to load a post by its ‘title’.

[lpb id=1 title='Sample Post' /]

PHP Function Code

In case you have difficulties debugging what causing issues with [lpb] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'lpb', [$this, 'onAddShortcode'] );

Shortcode PHP function:

function onAddShortcode( $atts ) {
		$post_id = $atts['id'];

		$post = get_post( $post_id );
		$blocks = parse_blocks( $post->post_content );

		return render_block( $blocks[0] );

Code file location:



Now that you’ve learned how to embed the Embed Lottie Player Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.


Leave a Reply

Your email address will not be published. Required fields are marked *