Title: Theme-Integration
Last modified: August 22, 2016

---

# Theme-Integration

 *  Resolved [NDDT](https://wordpress.org/support/users/nddt/)
 * (@nddt)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/theme-integration-16/)
 * Hi,
 * I tried to integrate the PlugIn with a theme I’m developing. It worked fine in
   the frontend after i had changed the hook for initialisation to ‘after-theme-
   setup’.
    In the Backend i could see the “Mega Menu Settings”. But the Buttons
   on the Menu-Items weren’t displayer. Can you give me some pointers why this problem
   occurs?
 * [https://wordpress.org/plugins/megamenu/](https://wordpress.org/plugins/megamenu/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [megamenu](https://wordpress.org/support/users/megamenu/)
 * (@megamenu)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/theme-integration-16/#post-5948608)
 * Hi NDDT,
 * Are you installing the plugin as a normal plugin or are you trying to package
   it in with the theme itself? If the latter then that may present a problem with
   paths, and might explain why the JavaScript which adds the buttons to each menu
   item aren’t being displayed.
 * Instead of packaging the plugin directly with the theme I recommend using this
   instead: [http://tgmpluginactivation.com/](http://tgmpluginactivation.com/)
 * If you’re already using that method, could you explain what you’re using the 
   after_theme_setup hook for? Do you see any JavaScript errors in the console on
   the menu page?
 * Regards,
    Tom
 *  Thread Starter [NDDT](https://wordpress.org/support/users/nddt/)
 * (@nddt)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/theme-integration-16/#post-5948623)
 * Hi Tom,
 * thanks for your reply. I packaged the plugin with a theme. And u were right. 
   The paths to the javascript were the problem.
 * I solved it by setting the path-variables to:
 *     ```
       define( 'MEGAMENU_VERSION',    $this->version );
       define( 'MEGAMENU_BASE_URL',   trailingslashit(get_template_directory_uri() . '/inc/plugins/megamenu') );
       define( 'MEGAMENU_PATH',       get_template_directory() . '/inc/plugins/megamenu/' );
       ```
   
 * For evrybody else reading this: You also have to change the init-hook to:
 *     ```
       add_action( 'after_setup_theme', array( 'Mega_Menu', 'init' ), 10 );
       ```
   
 *  Thread Starter [NDDT](https://wordpress.org/support/users/nddt/)
 * (@nddt)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/theme-integration-16/#post-5948648)
 * I have one more question: Where would i change the initial values for the options-
   page?
 *  Plugin Author [megamenu](https://wordpress.org/support/users/megamenu/)
 * (@megamenu)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/theme-integration-16/#post-5948666)
 * Hi NDDT,
 * Although what you’ve done will work, it may present problems further down the
   line… either your users will be stuck on v1.6 (there are already lots of extra
   cool features in v1.7) or when they update the plugin your changes will break–
   and they’ll have 2 copies of Max Mega Menu installed (one in your theme, one 
   in the usual wp-content/plugins directory).
 * Also, if you’re planning on submitting your theme to ThemeForest then they will
   reject it as you’re not allowed to include plugins directly in the themes (you
   must use the TGM Plugin class that I linked to above), I’m not sure what the 
   wordpress.org guidelines are but I suspect it would be the same story.
 * I personally am not fussed how you do it, just letting you know you might run
   into some issues doing it that way 🙂
 * Which options-page do you mean?
 * Regards,
    Tom
 *  Thread Starter [NDDT](https://wordpress.org/support/users/nddt/)
 * (@nddt)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/theme-integration-16/#post-5948669)
 * Hi Tom,
 * I won’t sell the Theme and it will only be handled by us. I’m developing it this
   way to set up new websites faster.
 * Thats why i want to change the default-values of Appearance-> Mega Menu.
 *  Plugin Author [megamenu](https://wordpress.org/support/users/megamenu/)
 * (@megamenu)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/theme-integration-16/#post-5948692)
 * Hi NDDT,
 * There’s not really a way to do that properly, but if you set up the menu how 
   you’d like (with all the settings etc), then do…
 *     ```
       $settings = get_option('megamenu_settings');
   
       var_dump($settings);
       ```
   
 * … you will see all the saved settings.
 * You’ll need to work out a way to insert those same settings when the theme is
   activated, something like this:
 *     ```
       $options = array(
           'css' => 'fs',
           'second_click' => 'go'
       );
   
       update_option('megamenu_settings', $options);
       ```
   
 * Regards,
    Tom

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Theme-Integration’ is closed to new replies.

 * ![](https://ps.w.org/megamenu/assets/icon-128x128.png?rev=1489843)
 * [Max Mega Menu](https://wordpress.org/plugins/megamenu/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/megamenu/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/megamenu/)
 * [Active Topics](https://wordpress.org/support/plugin/megamenu/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/megamenu/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/megamenu/reviews/)

## Tags

 * [Theme Integration](https://wordpress.org/support/topic-tag/theme-integration/)

 * 6 replies
 * 2 participants
 * Last reply from: [megamenu](https://wordpress.org/support/users/megamenu/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/theme-integration-16/#post-5948692)
 * Status: resolved