{"id":33903,"date":"2019-03-02T06:44:47","date_gmt":"2019-03-02T06:44:47","guid":{"rendered":"http:\/\/getshortcodes.com\/?post_type=docs&#038;p=33903"},"modified":"2019-05-28T14:10:09","modified_gmt":"2019-05-28T14:10:09","slug":"integrating-the-core-plugin-with-plugins-and-themes","status":"publish","type":"docs","link":"https:\/\/getshortcodes.com\/docs\/integrating-the-core-plugin-with-plugins-and-themes\/","title":{"rendered":"Integrating the core plugin with plugins and themes"},"content":{"rendered":"<p class=\"h2\">Table of contents<\/p>\n\n<ol><li><a href=\"#intro\">Intro<\/a><\/li><li><a href=\"#integrating-with-plugins\">Integrating with plugins<\/a><\/li><li><a href=\"#integrating-with-themes\">Integrating with themes<\/a><\/li><\/ol><\/li><\/ol>\n\n\n<h2 class=\"wp-block-heading\" id=\"intro\">Intro<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>You can download TGMPA script from&nbsp;<a href=\"http:\/\/tgmpluginactivation.com\/\">the official site<\/a>. On&nbsp;<a href=\"http:\/\/tgmpluginactivation.com\/configuration\/\">this <g class=\"gr_ gr_5 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Punctuation only-ins replaceWithoutSep\" id=\"5\" data-gr-id=\"5\">page<\/g><\/a>,&nbsp;you can find information on additional script settings.<\/p>\n\n\n\n<p>If you want to integrate one of the premium add-ons into your plugin or theme please read &#8220;Integrating premium add-ons with plugins and themes&#8221; article.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"integrating-with-plugins\">Integrating with plugins<\/h2>\n\n\n\n<p>At first, you should download TGMPA script and copy it to the directory of your plugin. In this article, we assume you&#8217;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:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/wp-content\/plugins\/your-plugin-name\/class-tgm-plugin-activation.php<\/pre>\n\n\n\n<p>Use the code below in your plugin code:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">require_once plugin_dir_path( __FILE__ ) . 'class-tgm-plugin-activation.php';<br><br>add_action( 'tgmpa_register', 'my_plugin_register_required_plugins' );<br><br>function my_plugin_register_required_plugins() {<br><br>  $plugins = array(<br>    array(<br>      'name'    =&gt; 'Shortcodes Ultimate',<br>      'slug'    =&gt; 'shortcodes-ultimate',<br>      'version' =&gt; '5.1.0',<br>    ),<br>  );<br><br>  \/\/ http:\/\/tgmpluginactivation.com\/configuration\/#h-plugin-parameters<br>  $config = array( 'id' =&gt; 'my_plugin' );<br><br>  tgmpa( $plugins, $config );<br><br>}<\/pre>\n\n\n\n<div class=\"wp-block-file\"><a href=\"https:\/\/getshortcodes.com\/wp-content\/uploads\/2019\/03\/example-plugin-1.zip\">example-plugin.zip<\/a><a href=\"https:\/\/getshortcodes.com\/wp-content\/uploads\/2019\/03\/example-plugin-1.zip\" class=\"wp-block-file__button\" download>Download<\/a><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"integrating-with-themes\">Integrating with themes<\/h2>\n\n\n\n<p>At first, you should download TGMPA script and copy it to the directory of your plugin. In this article, we assume you&#8217;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:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/wp-content\/themes\/your-theme-name\/class-tgm-plugin-activation.php<\/pre>\n\n\n\n<p>Use the code specified below in functions.php file of your theme:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">require_once get_stylesheet_directory() . '\/class-tgm-plugin-activation.php';<br><br>add_action( 'tgmpa_register', 'my_theme_register_required_plugins' );<br><br>function my_theme_register_required_plugins() {<br><br>  $plugins = array(<br>    array(<br>      'name'        =&gt; 'Shortcodes Ultimate',<br>      'slug'        =&gt; 'shortcodes-ultimate',<br>      'version'     =&gt; '5.1.0',<br>      'is_callable' =&gt; 'shortcodes_ultimate',<br>    ),<br>  );<br><br>  \/\/ http:\/\/tgmpluginactivation.com\/configuration\/#h-plugin-parameters<br>  $config = array( 'id' =&gt; 'my_theme' );<br><br>  tgmpa( $plugins, $config );<br><br>}<\/pre>\n\n\n\n<div class=\"wp-block-file\"><a href=\"https:\/\/getshortcodes.com\/wp-content\/uploads\/2019\/03\/example-theme-1.zip\">example-theme.zip<\/a><a href=\"https:\/\/getshortcodes.com\/wp-content\/uploads\/2019\/03\/example-theme-1.zip\" class=\"wp-block-file__button\" download>Download<\/a><\/div>\n\n\n\n<p><\/p>\n","protected":false},"featured_media":0,"template":"","docs_category":[23],"class_list":["post-33903","docs","type-docs","status-publish","hentry","docs_category-customization"],"_links":{"self":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/docs\/33903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/types\/docs"}],"wp:attachment":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/media?parent=33903"}],"wp:term":[{"taxonomy":"docs_category","embeddable":true,"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/docs_category?post=33903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}