Integrating the core plugin with plugins and themes

Table of contents

  1. Intro
  2. Integrating with plugins
  3. Integrating with themes

Intro

You can integrate core-plugin Shortcodes Ultimate in both premium and free plugins and themes. Specific instructions for plugins and themes are given below. All integrations are made with TGM Plugin Activation Script.

You can download TGMPA script from the official site. On this page, you can find information on additional script settings.

If you want to integrate one of the premium add-ons into your plugin or theme please read “Integrating premium add-ons with plugins and themes” article.

Integrating with plugins

At first, you should download TGMPA script and copy it to the directory of your plugin. In this article, we assume you’ve already copied the script file to the root of plugin directory (without subfolders). Thus, the full path to the script file will look like:

/wp-content/plugins/your-plugin-name/class-tgm-plugin-activation.php

Use the code below in your plugin code:

require_once plugin_dir_path( __FILE__ ) . 'class-tgm-plugin-activation.php';

add_action( 'tgmpa_register', 'my_plugin_register_required_plugins' );

function my_plugin_register_required_plugins() {

$plugins = array(
array(
'name' => 'Shortcodes Ultimate',
'slug' => 'shortcodes-ultimate',
'version' => '5.1.0',
),
);

// http://tgmpluginactivation.com/configuration/#h-plugin-parameters
$config = array( 'id' => 'my_plugin' );

tgmpa( $plugins, $config );

}

Integrating with themes

At first, you should download TGMPA script and copy it to the directory of your plugin. In this article, we assume you’ve already copied the script file to the root of plugin directory (without subfolders). Thus, the full path to the script file will look like:

/wp-content/themes/your-theme-name/class-tgm-plugin-activation.php

Use the code specified below in functions.php file of your theme:

require_once get_stylesheet_directory() . '/class-tgm-plugin-activation.php';

add_action( 'tgmpa_register', 'my_theme_register_required_plugins' );

function my_theme_register_required_plugins() {

$plugins = array(
array(
'name' => 'Shortcodes Ultimate',
'slug' => 'shortcodes-ultimate',
'version' => '5.1.0',
'is_callable' => 'shortcodes_ultimate',
),
);

// http://tgmpluginactivation.com/configuration/#h-plugin-parameters
$config = array( 'id' => 'my_theme' );

tgmpa( $plugins, $config );

}

Helpful?
🤝 Thank you!