Skip to content

Custom Actions Panel

The Total theme is an advanced and highly modular framework built on hooks. This means you can easily modify theme parts via your child theme using add_action and remove_action functions such as this example.

But, Total also caters to non-developers so if you are looking to insert a template or custom content via a hook you can do so easily under Theme Panel > Custom Actions. This panel will allow you to enter either HTML or shortcodes to any part of the theme and display it globally.

Important: For security reasons PHP is NOT allowed in the Custom Actions panel. If you need more advanced functionality that you can’t replicate using a page builder, shortcode or plain HTML you should use a child theme or code snippets plugin instead.

Adding Template Content to a Hook

One of the easiest ways to insert extra content anywhere on your site that isn’t inside the standard page content or a widget area is using the Custom Actions panel.

While you can insert custom HTML into this panel, it’s recommended that you instead create a new Dynamic Template “part” and insert it’s shortcode into the Custom Actions panel. At least for more complicated stuff, if you simple want to insert some text at the top of your site you can accomplish this using simple HTML and theme utility classes.

Step 1: Create a New Template “Part”

First go to Theme Panel > Dynamic Templates and create a new template with the “Part” option selected for the Template “Type”.

Total Theme Create New Template Part

Step 2: Copy the Template Part Shortcode

Once you’ve created your template go back to the main Dynamic Templates admin screen and click on the “Part” filter link at the top. Now you will be able to see all your template parts and copy the shortcode for your template.

Total Theme Copy Template Part Shortcode

Step 3: Paste your Shortcode into the Custom Actions Panel

Now you can go to the Custom Actions panel and insert your shortcode into your hook of choice.

Total Theme Custom Actions Insert Shortcode

If you are inserting a template part into the custom actions panel you should never do so in the wp_head hook because you shouldn’t add HTML into your website’s <head> tag.

Custom Actions Priority Field

The priority field is used to define the priority of your code in relation to other code inserted into the same hook. In WordPress the default priority for any add_action function is 10. The smaller the number the “sooner” it will be added to the page and the greater the “later” it will be inserted.

Lets say you are inserting code into the wpex_hook_header_inner action hook. By default the theme uses this same hook to add your header logo, menu, aside content, mobile menu..etc. For the most part any actions added by the theme will use the default priority of 10.

So if you wanted your code to be added before anything gets added by the theme you will use a smaller priority such as 1 and if you wanted your code to be added after anything the theme adds you can use a greater priority such as 100.

For the most part, if you want your code added after items added by the theme you won’t need to modify the priority because the Custom Actions panel runs after the theme’s actions so your code will always be added last.

Centering Content Inside a Custom Action Hook

If you are using an action hook that’s outside of a centered container (for example the wp_body_open hook) you will probably want to center your content so that it’s inline with the rest of the website.

To center your content all you need to do is wrap your element inside a div with a “container” classname like the example below:

<div class="container">[wpex_template id="4888"]</div>
Back To Top