9.4.Demo Content


As a developer of wordpress themes, it is very important to provide your users a simple way to import the demo content. LMM includes a demo that contains all possible combinations of menu layouts, and some examples of possible styles.

But this content becomes irrelevant for your theme users, so we have included the possibility to change the demo in the tab LMM Options& Demo Importer to your own.

The next filter, allows you to change the path of the folder that contains your demo content

add_filter('quadmenu_import_demo_path', 'my_hook_import_demo_path');

function my_hook_import_demo_path($file = '') {
return get_template_directory() . '/quadmenu/demos/';
}

Set the theme location to the menu after import.

add_action('wbc_importer_after_content_import', 'my_hook_import_demo_menus', 10, 2);

function my_hook_import_demo_menus($demo_active_import, $demo_directory_path) {

 reset($demo_active_import);

 $current_key = key($demo_active_import);

 if (!empty($demo_active_import[$current_key]['directory'])) {

 $top_menu = get_term_by('name', 'My Menu', 'nav_menu');

 if (isset($top_menu->term_id)) {
 set_theme_mod('nav_menu_locations', array(
 'primary' => $top_menu->term_id,
 'my_theme_location' => $top_menu->term_id,
 )
 );
 }
 }
}

How to create my demo content?

  1. Inside my_theme/quadmenu/demos/ create a demo content folder. IE demo1, demo2, etc.
  2. Create content.xml file by exporting your WordPress content using the WordPress’s export function tools & export
  3. (optional) Create a widgets.txt file using Widget Importer  Exporter plugin. It will export as .wie file, just rename file to widgets.txt
  4. (optional) Create theme-options.txt file, get content from your LMM Options & Import/Export.
  5. Create a 320x240 screenshot image called screen-image.jpg, supports .png,.gif as well.
  6. That’s All! Repeat steps 2-6 for each demo content set/import you want.