Hooks/Action Reference/builder start

From iThemes Codex
Jump to: navigation, search


This action hook is called when the Builder code stack first starts to run. It isn't used by Builder or any of the Builder plugins.

Possible Uses

The main reason for this hook is for other code to use it as an init hook that only runs when Builder is active. This could be useful if the feature is only valuable when used with Builder or if the code would break if Builder isn't present.



Example Use

This is an example plugin's main file that is used to load the rest of the plugin code when the builder_start action fires.

To try out the example, create a new plugin directory at wp-content/plugins, such as wp-content/plugins/builder-example-plugin, and add two empty files to the directory: init.php and features.php.

Plugin Name: Builder Example Plugin
Plugin URI: http://ithemes.com/
Description: Example plugin that shows how plugin features can be loaded only when the Builder theme is active.
Author: Chris Jean
Version: 1.0.0
Author URI: http://chrisjean.com/

// The bep_ prefix is used to stand for "Builder Example Plugin" and helps
// prevent name collisions with other plugins.
function bep_init() {
    require_once( dirname( __FILE__ ) . '/features.php' );
add_action( 'builder_start', 'bep_init' );

You can download this example plugin here.

Back to Builder Hooks