Now is your last chance to buy a lifetime license before we switch to annual pricing. Existing licenses will be unaffected.
read more
docs PHP, CSS & JS


This article covers how to add Custom PHP & HTML to your site. There are two primary ways to add custom PHP to your site with Oxygen. The first option is to use an additional plugin to add the code; the second option is a Code Block element.

Adding Code Through a Plugin

Due to how Oxygen disables the default WordPress theme system, the custom code added to your theme's function.php file is not recognized. Instead, you'll want to create a custom plugin or use a third-party code snippet plugin to add your code. Some plugins we recommend are:

If you'd like to create a custom plugin, please see the following WordPress documentation.

Adding Code Through a Code Block

Adding custom PHP & HTML to your site using a Code Block element in Oxygen is possible. This is useful for calling functions in WordPress (we don't recommend creating functions in a Code Block), running WordPress loops, making database queries, displaying custom fields from other plugins, and other WordPress API functions.

Code added to a Code Block is executed inside Oxygen, allowing you to see the results of your code in the -Preview Window-.

Deciding The Best Method

Oxygen's Code Blocks are called during the_post WordPress action (Action Reference). So, some code will not work correctly in a Code Block and should be placed within a Plugin. Here's a quick reference showing where to add custom code to your site for common scenarios. Please note this table is simply a guide, and you'll want to evaluate which method works best for you.

ScenarioUse a PluginUse a Code Block
Adding new functions to your websiteYESNO
Adding information to your site's header or footerYESNO
Loading a Script or Style via HTMLYESYES
Running custom code on a page/templateYESYES
Adding a new Oxygen ConditionYESNO
Last modified: January 9, 2024
Copyright © 2024 Soflyy
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram