You can include custom PHP code in your pages in a couple ways…
Including code at the page configuration level
Step 1: Create your code block
In this case, you’ll use a basic text block for your code. In the Add Content menu, select Block > Basic > Text Block.
Add you code as the text block content.
Be sure to wrap your code in the correct code section tags!
Step 2: Add your code to the page configuration
Edit the desired page.
Select the Configure tab.
Select the php output.
In the CODE region, use the asset selector to select your code block.
You can leave the format selector empty
Including code within the page content
Step 1: Create your code block
In this scenario, you’ll need to create a Code block, which is different than adding code to a basic text block. In the Add Content menu, select Block > Code.
Use the Cascade wrapper tag field to auto-wrap you code in the desired passthrough or protect tag. If you select None, you will need to manually add the wrapper tags in your code. This may be desireable if you want to divide the code up into different types of wrapper tags.
→ More: Code Sections on the Hannon Hill Knowledge Base
Enter your code in the Code data definition field.
Step 2: Add the code block to the page content
You can add the code block anywhere you’d add a layout or widget.
→ More: Working with pages
→ More: Layout builder pattern