In a PSD > WP project that I recently completed, the requirement was to implement Tocbot on all Pages that use a specific Oxygen Template.

With a traditional theme-based approach we can use is_page_template( 'page-example.php') to target all Pages that use a page template so that wp_enqueue_script() can be called inside a if conditional.

add_action( 'wp_enqueue_scripts', 'custom_enqueue_files' );
 * Loads <list assets here>.
function custom_enqueue_files() {

	if ( is_page_template( 'page-example.php' ) ) {
		wp_enqueue_script( 'tocbot', plugin_dir_url( __FILE__ ) . 'assets/js/tocbot.min.js', array(), '4.3.1', true );


This is not possible with Oxygen but we can do a little out of the box thinking and achieve it like so:

  • add a body class to the Pages that use the Oxygen Template
  • loop through all the body classes, look for the above body class and then enqueue the script.

This members-only tutorial provides the details to implement the above.

Step 1

Edit the Oxygen Template.

Add a Code Block.


This is a premium members-only content.

To view the rest of the content, please sign up for membership ($37/month or $399 one-time).

Already a member? Log in below or here.

Need help implementing a tutorial in your site or want to hire me for custom work?


Find the article helpful and wish to donate?



For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: