esc_html__( 'Theme demo content', 'mustang-lite' ),
'import_file_url' => esc_url_raw( 'https://raw.githubusercontent.com/webmandesign/demo-content/master/mustang/content/demo-content-mustang.xml' ),
'import_widget_file_url' => esc_url_raw( 'https://raw.githubusercontent.com/webmandesign/demo-content/master/mustang/widgets/mustang-widgets.wie' ),
),
);
} // /files
/**
* 20) Texts
*/
/**
* Info texts
*
* @since 1.6
* @version 1.6
*
* @param string $text Default intro text.
*/
public static function info( $text = '' ) {
// Processing
$text .= '
';
$text .= '';
$text .= '
';
$text .= esc_html__( 'Install required plugins!', 'mustang-lite' );
$text .= '
';
$text .= '
';
$text .= esc_html__( 'Please read the information about the theme demo required plugins first.', 'mustang-lite' );
$text .= ' ' . esc_html__( 'If you do not install and activate demo required plugins, some of the content will not be imported.', 'mustang-lite' );
$text .= ' ';
$text .= esc_html__( 'View the list of required plugins »', 'mustang-lite' );
$text .= '';
$text .= '
';
$text .= '
';
// Output
return $text;
} // /info
/**
* 30) Setup
*/
/**
* After import actions
*
* @since 1.6
* @version 1.7.1
*
* @param string $selected_import
*/
public static function after( $selected_import = '' ) {
// Processing
// Front and blog page
self::front_and_blog_page();
// Menu locations
self::menu_locations();
// Widgets
self::widgets();
// Beaver Builder setup
self::beaver_builder();
} // /after
/**
* Setup front and blog page
*
* @since 1.6
* @version 1.6
*/
public static function front_and_blog_page() {
// Processing
update_option( 'show_on_front', 'page' );
// Front page
$page_front = get_page_by_path( 'home' );
update_option( 'page_on_front', $page_front->ID );
// Blog page
$page_blog = get_page_by_path( 'blog' );
update_option( 'page_for_posts', $page_blog->ID );
} // /front_and_blog_page
/**
* Setup navigation menu locations
*
* @since 1.6
* @version 1.6
*/
public static function menu_locations() {
// Helper variables
$menu = array();
$menu['main'] = get_term_by( 'slug', 'main', 'nav_menu' );
// Processing
set_theme_mod( 'nav_menu_locations', array(
'main' => ( isset( $menu['main']->term_id ) ) ? ( $menu['main']->term_id ) : ( null ),
) );
} // /menu_locations
/**
* Remove all widgets from sidebars first
*
* @since 1.6
* @version 1.7.1
*/
public static function before_widgets_import() {
// Processing
delete_option( 'sidebars_widgets' );
} // /before_widgets_import
/**
* Setup widgets
*
* @since 1.7.1
* @version 1.7.1
*/
public static function widgets() {
// Helper variables
// Custom Menu widget
$widget_settings_nav_menu = get_option( 'widget_nav_menu' );
$menu = array();
$menu['main'] = get_term_by( 'slug', 'main', 'nav_menu' );
$setup_widgets = array( 'main' );
// Processing
// Custom Menu widget
$i = 0;
foreach ( $widget_settings_nav_menu as $key => $instance ) {
if (
isset( $instance['nav_menu'] )
&& isset( $menu[ $setup_widgets[ $i ] ]->term_id )
) {
$widget_settings_nav_menu[ $key ]['nav_menu'] = $menu[ $setup_widgets[ $i++ ] ]->term_id;
}
} // /foreach
update_option( 'widget_nav_menu', $widget_settings_nav_menu );
} // /widgets
/**
* Setup Beaver Builder
*
* @since 1.7.1
* @version 1.7.1
*/
public static function beaver_builder() {
// Processing
// Page builder enabled post types
update_option( '_fl_builder_post_types', array(
'page',
'wm_projects',
) );
} // /beaver_builder
/**
* 100) Helpers
*/
/**
* OCDI plugin admin page styles
*
* @since 1.7.1
* @version 1.7.1
*/
public static function styles() {
// Processing
// OCDI 2.0 styling fix
wp_add_inline_style(
'ocdi-main-css',
'.ocdi.about-wrap { max-width: 66em; }'
);
} // /styles
} // /Mustang_One_Click_Demo_Import
add_action( 'after_setup_theme', 'Mustang_One_Click_Demo_Import::init', 5 );