Advertisement
salmancreation

one click demo code - code

May 13th, 2019
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.37 KB | None | 0 0
  1. <?php
  2. // OneClick Demo Importer
  3. add_filter( 'pt-ocdi/import_files', 'filix_import_files' );
  4. function filix_import_files() {
  5.     return array(
  6.         array(
  7.             'import_file_name'             => esc_html__('Filix Demo', 'filix'),
  8.             'local_import_file'            => trailingslashit( get_template_directory() ) . 'inc/demo/filix-demo-contents.xml',
  9.             'local_import_widget_file'     => trailingslashit( get_template_directory() ) . 'inc/demo/filix-widgets.wie',
  10.             'import_preview_image_url'     => trailingslashit( get_template_directory_uri() ).'inc/demo/screenshot.png',
  11.             'import_notice'                => esc_html__( 'Install and active all required plugins before you click on the "Import Demo Data" button.', 'filix' ),
  12.             'preview_url'                  => 'http://filix.droitthemes.com',
  13.             'local_import_redux'           => array(
  14.                 array(
  15.                     'file_path'   => trailingslashit( get_template_directory() ) . 'inc/demo/filix-theme-options.json',
  16.                     'option_name' => 'filix_opt',
  17.                 ),
  18.             ),
  19.         ),
  20.     );
  21. }
  22.  
  23. add_filter( 'pt-ocdi/disable_pt_branding', '__return_true' );
  24.  
  25. function filix_after_import_setup() {
  26.     // Assign menus to their locations.
  27.     $main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
  28.  
  29.     set_theme_mod( 'nav_menu_locations', array(
  30.             'main_menu' => $main_menu->term_id,
  31.         )
  32.     );
  33.  
  34.     // Assign front page and posts page (blog page).
  35.     $front_page_id = get_page_by_title( 'Home' );
  36.     $blog_page_id  = get_page_by_title( 'Blog' );
  37.  
  38.     update_option( 'show_on_front', 'page' );
  39.     update_option( 'page_on_front', $front_page_id->ID );
  40.     update_option( 'page_for_posts', $blog_page_id->ID );
  41.  
  42. }
  43. add_action( 'pt-ocdi/after_import', 'filix_after_import_setup' );
  44.  
  45.  
  46. function filix_plugin_page_setup( $default_settings ) {
  47.     $default_settings['parent_slug'] = 'themes.php';
  48.     $default_settings['page_title']  = esc_html__( 'Filix - One Click Demo Import' , 'filix' );
  49.     $default_settings['menu_title']  = esc_html__( 'Import Filix Demo Data' , 'filix' );
  50.     $default_settings['capability']  = 'import';
  51.     $default_settings['menu_slug']   = 'pt-one-click-demo-import';
  52.  
  53.     return $default_settings;
  54. }
  55. add_filter( 'pt-ocdi/plugin_page_setup', 'filix_plugin_page_setup' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement