Title: [Plugin: OptionTree] Theme Integration
Last modified: August 19, 2016

---

# [Plugin: OptionTree] Theme Integration

 *  [Ruven](https://wordpress.org/support/users/harta-e/)
 * (@harta-e)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/)
 * Really cool and easy to use plugin!
 * I was just wondering, if I can also integrate it into a theme, so the theme users
   don’t have to deal with plungin installation and data import. I would like to
   provide out of the box functionality. So as soon as the user activates the theme,
   he should have the theme option menu with all the options ready to start.
 * Is that pollible now or in future versions?
 * Thank you.

Viewing 15 replies - 1 through 15 (of 33 total)

1 [2](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/page/2/?output_format=md)

 *  [_rg_](https://wordpress.org/support/users/arriba/)
 * (@arriba)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728216)
 * +1
 *  Plugin Author [Derek Herman](https://wordpress.org/support/users/valendesigns/)
 * (@valendesigns)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728396)
 * It would take a huge overhaul to make THIS code a class you could just plugin
   into WordPress. I know some of you think that is ideal, but how would updates
   be distributed to the community?
 * I could look into it but I can’t promise anything. I have a lot of work to do
   on the OptionTree container site and Envato is launching a few new projects I
   need to finish soon so making this a class will have to wait till I have a moment
   of free time, sorry.
 * I promise I will look into it though.
 *  [GhostPool](https://wordpress.org/support/users/ghostpool/)
 * (@ghostpool)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728480)
 * Wow, this is excellent plugin Derek. I’ll add my +1 to this thread.
 * I have managed to integrate the plugin into the theme so it doesn’t require activation
   via the plugin directory, all I need to know now is, is there a page I can insert
   my options code into in the following form for instance:
 *     ```
       array(
               'item_id' => $item_id,
               'item_title' => $item_title,
               'item_desc' => $item_desc,
               'item_type' => $item_type,
               'item_options' => $item_options,
               'item_sort' => $id
             )
       ```
   
 * I tried adding something similar to where the Test Input field is inserted in
   class.admin.php, but it doesn’t seem to work. Is the plugin not capable of this
   type of customization in it’s current form?
 *  Plugin Author [Derek Herman](https://wordpress.org/support/users/valendesigns/)
 * (@valendesigns)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728481)
 * I’ve thought of some ideas for making this more theme developer friendly. I’ll
   work out my idea and hopefully if time permits have it updated next week.
 * It’s not going to be a class but will allow a sort of hidden default array.
 *  [Gilles Vauvarin](https://wordpress.org/support/users/vauvarin/)
 * (@vauvarin)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728488)
 * Great job Derek, very usefull plugin !
 * GhostPool, did you right a post to explain how integrate Derek’s plugin into 
   the theme ? I’m very interesting.
 * Thank you
 *  [Gilles Vauvarin](https://wordpress.org/support/users/vauvarin/)
 * (@vauvarin)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728489)
 * … did you write … sorry
 *  [GhostPool](https://wordpress.org/support/users/ghostpool/)
 * (@ghostpool)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728490)
 * All you need to do is refer to the index.php file that comes with the plugin 
   in functions.php e.g.
 *     ```
       require_once (TEMPLATEPATH . 'option-tree/index.php');
       ```
   
 * Then remove the references to the plugin directory from index.php:
 *     ```
       define( 'OT_PLUGIN_DIR', ...
       define( 'OT_PLUGIN_URL', ...
       ```
   
 * And add this to functions.php:
 *     ```
       define( 'OT_PLUGIN_DIR', get_template_directory_uri() . '/lib/admin/inc/option-tree');
       define( 'OT_PLUGIN_URL', get_template_directory_uri() . '/lib/admin/inc/option-tree');
       ```
   
 * Obviously replacing it with your own directory structure.
 *  [Gilles Vauvarin](https://wordpress.org/support/users/vauvarin/)
 * (@vauvarin)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728491)
 * Sorry but i’ve got a problem, i’m not php developper, just a designer 😉
 * So i did that :
 * I putted the option-tree folder in my theme folder: MyTheme > option-tree
 * I commented this two lines in the option-tree index.php
 *     ```
       // define( 'OT_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
       // define( 'OT_PLUGIN_URL', WP_PLUGIN_URL . '/' . dirname( plugin_basename( __FILE__ ) ) );
       ```
   
 * I added this in my functions.php theme
 *     ```
       require_once (TEMPLATEPATH . '/option-tree/index.php');
       define( 'OT_PLUGIN_DIR', get_template_directory_uri() . '/option-tree');
       define( 'OT_PLUGIN_URL', get_template_directory_uri() . '/option-tree');
       ```
   
 * The first line seems ok, i think the problem comes from the second and third 
   line of code.
 * Result :
 * I see the option-tree box in my left admin sidebare but the center of the page
   is empty (no forms in the center of the admin page) but just this message display:“
   No direct script access allowed”
 * Any idea of my mistake ?
 *  [GhostPool](https://wordpress.org/support/users/ghostpool/)
 * (@ghostpool)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728492)
 * Make sure you did not remove the version number reference from index.php e.g.
 *     ```
       define( 'OT_VERSION', '1.1.1' );
       ```
   
 *  [Gilles Vauvarin](https://wordpress.org/support/users/vauvarin/)
 * (@vauvarin)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728493)
 * My version number reference in index.php is ok and not comment.
 * Maybe you might send me your index.php and functions.php to compare with mine.
 * gillesvauvarin[at]gmail[dot]com
 * Thank you for your help.
 *  [OllieMcCarthy](https://wordpress.org/support/users/olliemccarthy/)
 * (@olliemccarthy)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728510)
 * [@ghostpool](https://wordpress.org/support/users/ghostpool/) and [@vauvarin](https://wordpress.org/support/users/vauvarin/)–
   did you figure out what was wrong? I have followed the same proceedure and get
   some warnings referring to class.admin.php
 * `Warning: include() [function.include]: http:// wrapper is disabled in the server
   configuration by allow_url_include=0 in C:\wamp\www\startup\wp-content\themes\
   silverpoint\option-tree\classes\class.admin.php on line 372`
 *  [OllieMcCarthy](https://wordpress.org/support/users/olliemccarthy/)
 * (@olliemccarthy)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728511)
 * I got it to work. I used TEMPLATEPATH to link up the frontend files on the lines
   where the warnings referred.
 *  [dejanc](https://wordpress.org/support/users/dejanc/)
 * (@dejanc)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728516)
 * +1
 *  [Vasilisten](https://wordpress.org/support/users/vladnovo/)
 * (@vladnovo)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728518)
 * I’m also interested in inserting option code manually. Have anyone already done
   it?
 *     ```
       array(
               'item_id' => $item_id,
               'item_title' => $item_title,
               'item_desc' => $item_desc,
               'item_type' => $item_type,
               'item_options' => $item_options,
               'item_sort' => $id
             )
       ```
   
 *  [mydearvalentine](https://wordpress.org/support/users/mydearvalentine/)
 * (@mydearvalentine)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/#post-1728519)
 * Thanks for the solution I was also looking for the same …

Viewing 15 replies - 1 through 15 (of 33 total)

1 [2](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/page/2/?output_format=md)

The topic ‘[Plugin: OptionTree] Theme Integration’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/option-tree_363534.svg)
 * [OptionTree](https://wordpress.org/plugins/option-tree/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/option-tree/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/option-tree/)
 * [Active Topics](https://wordpress.org/support/plugin/option-tree/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/option-tree/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/option-tree/reviews/)

## Tags

 * [OptionTree](https://wordpress.org/support/topic-tag/optiontree/)

 * 33 replies
 * 20 participants
 * Last reply from: [arjanv](https://wordpress.org/support/users/arjanv/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-optiontree-theme-integration/page/3/#post-1728598)
 * Status: not resolved