Documentation

Reusable Content & Text Blocks WordPress Plugin

Placing Content Blocks Using PHP 2017-11-24T11:17:30+00:00

Placing Content Blocks Using PHP

If you are a web developer (or comfortable using PHP) and there are inaccessible areas of the theme where you want to enable content that you or your clients can amend as and when they need, you can use the provided PHP functions to embed content blocks.

The basic function syntax is as follows, making reference to your content block either using the its ID or slug:

<? echo ls_content_block_by_id( <ID> ); ?>
<? echo ls_content_block_by_slug( '<SLUG>' ); ?>

You can also use the “para” parameter, which gives you greater control over how the content is filtered. For example:

<? echo ls_content_block_by_id( <ID>, '<PARA>' ); ?>
<? echo ls_content_block_by_slug( '<SLUG>', '<PARA>' ); ?>

See this section for full information regarding content processing and the PARA parameter.

An extensive list of the PHP code snippets for each content block can be found on the edit page for the specific block.