This modifier enables you to trim the content of a Gutenberg WordPress post by specifying a range of heading blocks. Within the defined range, it also includes any non-heading content such as paragraphs, images, and buttons.
The code counts the Core/Heading blocks from a Gutenberg post, Generateblocks/Headline from GenerateBlocks, and Kadence/Advancedheading from Kadence Blocks. Other 3rd party block plugins may not work.
Working with:
- Core Gutenberg
- GenerateBlocks
- Kadence Blocks
Use Case
This Voxel Mod is particularly useful for inserting ads or banners after a specific number of headings (and their associated content) within a single post template.
For instance, after the third heading, you can place a banner or call-to-action (CTA) by setting the start heading to 0 (the beginning of the post) and the end heading to 3 (and its following non-heading content).
Noe: You must use @post(content), not @post(:content). ie. the dynamic tag must not have the colon (:).


To achieve this, you’ll need two or more Text Editor widgets in your post template, each configured with a different range of the post content.
The CTA can then be added between these Text Editor widgets. The post will continue seamlessly by setting the start heading to 4 and leaving the end heading field blank, displaying all content from heading 4 to the end of the post.
Benefits
This method offers a flexible and dynamic way to structure your content, allowing for programmatic ad insertions exactly where you want them. It ensures a smooth and uninterrupted user experience while optimizing space for advertisements or promotional banners.
Heading Number Inputs:
Start Heading (0 for start): This input defines the starting point for the content you want to display:
- 0 means the modifier will start from the very beginning of the post, including any content before the first heading (like images, paragraphs, or other blocks).
- 1 means the modifier will start from the first heading block.
- 2 means the modifier will start from the second heading block, and so on.
End Heading (leave blank for end): This input defines the endpoint for the content you want to display:
- If you leave this field blank, the content will continue until the end of the post, including all headings and other elements that follow.
- If you specify a number, the modifier will stop the content display at the specified heading block and will include any non-heading HTML content that follows. For example, if you specify end = 2, it will show all content grouped under heading 2, until the next available heading.
*** Notice this CTA banner is injected after the 3rd heading’s content on all articles. Voxel Mods! ***