Documentation-based practice example; check the controls in your installed Oxygen version.
What it does and when to use it
Run server-side PHP for a custom rendering task. This example focuses on one achievable outcome rather than listing every possible setting.
Before you start
Start with a test page and the data or assets described in the example. The values below are starting points, not universal design defaults.
Worked example: An escaped server-rendered summary
Scenario: An escaped server-rendered summary. The goal is a useful result on a real project, not a claim that this scenario was a completed client project.
- Choose PHP only when a native dynamic binding cannot express the requirement.
- For a simple count, use a server-side integer and render it as escaped text.
- Test with a normal value, zero and missing data in a staging page before deploying the snippet.
An escaped static-count illustration
$count = 3;
echo '<p>' . esc_html( (string) $count ) . ' items</p>';
This deliberately small snippet illustrates output escaping; it does not query your site. Use an available, trusted PHP workflow on staging. PHP Code is not registered as an element here.
Expected result
You should have an escaped server-rendered summary. Verify the result on the frontend using the same content or object described in the steps. A correct builder preview alone does not establish that links, data or interactions work for visitors.
Troubleshooting
If the snippet fails, inspect the server error rather than exposing debugging output to visitors. PHP Code is documented but not registered in this installation; do not insert user-supplied executable code.
Checks before publishing
Escape dynamic output and never evaluate visitor-supplied code. The documented PHP Code element is not registered in the current site build.
- Compare desktop and narrow-screen layouts using actual content.
- Follow every destination and operate interactive controls with a keyboard where applicable.
- Check an empty or unavailable-data state when the element depends on a provider.
Official reference and version notes
Official PHP Code reference provides the current provider information. This is independent, AI-assisted documentation on Benjamin Olsen’s website; examples are clearly identified as practice recipes.
The native references were checked against the site’s Oxygen 6.2.0-beta.9 installation and public documentation. Individual recipes should still be validated in your project.