Page block is a custom post type that will help you create custom content for specific theme positions. You can also use a page block instead of site hero section or footer. Please note that this post type must utilize the theme page builder in order to create a page block. Page block contains following options;
- Block Position - Select page block position. See positions map image below.
- Block Assignment - Select page block assignment. Not effective if "Assign to" option is empty.
- Assign to - Assign the page block to specific page. Select from the list or start typing to load specific pages. If empty page block is visible on all pages.
- Unassign from - Unassign this page block from specific page. Select from the list or start typing to load specific pages. This options works in conjunction with Assign to. Example; if Block assignment is Show and you assign this block to all single posts and unassign from specific single post, the block is not visible on that specific post. If however the Block assignment is Hide than the block is visible only on specific single post and hidden from all other single posts.
- Block visibility - Select user roles that can see the page block.
- Visible to - If unchecked everyone can still see the page block. If you select Logged in than all users that are logged in will see this block. For more restrictive visibility do not use Logged in but rather select the user role. Logged out option makes this block visible to site visitors only.
Page blocks positions map
Use the position map above to assign the page block to desired position. Note that multiple page blocks can be assigned to same position. If you need to sort their order we recommend you use Post Types Order plugin for blocks reorder.
Offcanvas pageblock position
Offcanvas pageblock position will display any pageblock in a offcanvas overlay position if a selected header layout is, Offcanvas push out, Offcanvas slide out, Mini and Mini Right. You can see it in action on Vibrant theme demo.
Using the page block instead of hero section or footer
Page block can also be used instead of theme hero section or footer. Watch the video above to understand how to acheive this.
Adding custom page block position
There are currently 10 page blocks positions that you can use. If you wish to add more please use this filter;
function my_filter_pageblocks_positions_list ( $custom_kits ){ $custom_positions = array( 'my_position' => esc_html__('My position name', 'creatus'), ); return $custom_positions; } add_filter('thz_filter_pageblocks_positions_list', 'my_filter_pageblocks_positions_list' );
Than anywhere in the child theme where you wish your position to appear add following function;
<?php thz_page_block($position, $echo);?>
Function attributes:
- $position - Page block position name.
- $echo - true by default, return if false.
Usage example:
<?php thz_page_block('my_position'); ?>