A block is an element of a web page layout, which is used as a container for widgets.

To add a block to your theme's layout, place the code below in desired location of your layout file.

<?php echo ipBlock('blockName')->render(); ?>

Naming convention

You can put anything you like instead of blockName, however, avoid spaces and special characters.
The main block, where the most important content of the page goes, has to be named as main.
f you have more blocks, call them side1, side2, etc. We suggest keeping this naming as it makes switching between themes easier.

Repeating block content on multiple pages

To repeat the same content of a specific block on multiple pages, make this block static, as displayed in the example below.

<?php echo ipBlock('side1')->asStatic()->render(); ?>

The example code above, when used in website's theme layout files, outputs the same content on every page of the website.

main block cannot be set as static. 

Manipulating blocks

You can alter block HTML by catching ipBlockContent filter or even replace the way blocks are generated as a whole by catching ipGenerateBlock job.

Use a code bellow to block's content as HTML:

<?php $mainBlockHtml = ipContent()->getBlockContent('main'); ?>

See also

comments powered by Disqus