How-to: package the vision shortcodes plugin into any wordpress theme

Posted in:

Overview

This article outlines how to package or hard-code the Vision Shortcodes Plugin into any WordPress Theme.

Option #1:

The easiest option is to leave the Vision plugin as-is and include it into your theme using the TGM Plugin Activation script.

  • The TGM script will display a notification within the user’s dashboard as soon as your theme is activated.
  • It then provides users with a very easy-to-use and slick interface for installing the Vision Plugin
  • This makes things super easy because anytime a new version of Vision is released you won’t need to change anything in your code – simply update the Plugin ZIP file on your server and you’re user will get the latest version.

Please visit http://tgmpluginactivation.com/ for complete details.


Option #2:

The other option is to “hard-code” the Vision Plugin directly into your WordPress Theme. We will be using WordPress’ default Twenty Twelve theme for this tutorial.

  1. Purchase and download the Vision-Plugin-Package.zip from CodeCanyon.net
  2. Unzip this package onto your desktop computer and locate vision.zip ←this is the actual plugin itself
  3. Unzip vision.zip and locate the folder named Vision
  4. Copy the entire Vision folder into your theme’s root folder.
  5. Open up Vision/vision.php and find the following line of codes:
/*-----------------------------------------------------------------------------------*/
/*	Define File Paths
/*-----------------------------------------------------------------------------------*/
define('VISION_TINYMCE_URI', WP_PLUGIN_URL . '/vision');
define('VISION_TINYMCE_PATH', WP_PLUGIN_DIR . '/vision');


Change the above code to the following:
(this will change from plugin path to theme path)

/*-----------------------------------------------------------------------------------*/
/*	Define File Paths
/*-----------------------------------------------------------------------------------*/
define('VISION_TINYMCE_URI', get_template_directory_uri() . '/vision');
define('VISION_TINYMCE_PATH', get_template_directory() . '/vision');

Open up Vision/get_wp.php and find the following code:

//include wp-load.php
$root = dirname(dirname(dirname(dirname(__FILE__))));


Change the above code to the following:

//include wp-load.php
$root = dirname(dirname(dirname(dirname(dirname(__FILE__)))));

Open up your themes functions.php file and add the following code:

if(!function_exists('vision_enqueue_script')){
require_once('vision/vision.php');
}

That’s all.

Happy coding :)

hardcode vision, hard-code, hardcoding, include vision, package vision, vision theme, Vision, Hard-code, Package Vision