Documentation

Advanced Shortcodes

Redirect visitors, include PHP or HTML files, and trigger WordPress actions from the editor.

These elements are aimed at developers and site builders who need more than If/Else. They are optional.

Redirect to another page

Add the Redirect element at the top of the editor to send visitors elsewhere before the page content is read.

WP Brain Redirect element settings with a destination URL
Redirecting visitors from the page editor.

Put the redirect inside If/Else containers to send different visitors to different destinations — for example, guests to the login page.

Include a PHP or HTML file

WP Brain Include renders the contents of an HTML or PHP file inside a page or post without creating a shortcode for every file.

WP Brain Include element settings with a file path field
Including a PHP or HTML file by path.

The path is relative to the WordPress root (ABSPATH). For a file in your theme, start with /wp-content/themes/ and continue from there.

Trigger WordPress actions

The Action element fires a custom WordPress action at any point in your content — useful when you want to render output that is linked to a hook.

All functions attached to wp_brain_test are called, equivalent to do_action('wp_brain_test'); in PHP.

Repeat elements

Use the Loop element to repeat content with a changing index.

The three parameters set the start index, the end limit and the increment step. In programming terms, it behaves like a for loop.

Inside the loop, $index is replaced by the current index in any child shortcode.

A loop over five posts, for example, is equivalent to writing:

[show_post id=1]
[show_post id=2]
[show_post id=3]
[show_post id=4]
[show_post id=5]

That covers the advanced shortcodes. Tell us which shortcodes you'd like to see next.