Overview

Smart One Click Setup is a powerful WordPress plugin that allows theme authors to define import files in their themes, making it incredibly easy for users to import demo content with just one click.

0:00 / 0:00

For Theme Authors

Setup Smart One Click Setups for your theme and your users will thank you for it! You can make any theme compatible with this plugin in 15 minutes and make it much more user-friendly.

For Theme Users

Contact the author of your theme and let them know about this plugin. Theme authors can make any theme compatible with this plugin in 15 minutes and make it much more user-friendly.

Plugin Information

  • Version: 1.3.9

  • Requires WordPress: 5.5+
  • Tested up to: 6.8
  • Requires PHP: 7.4+
  • License: GPLv3 or later
  • Contributors: Chiranjit Hazarika

Key Features

✨ One-Click ZIP Import/Export

Export everything to a single ZIP file - content, widgets, customizer, plugins, and Elementor data. Import from a single ZIP file - automatically detects and imports all available data.

🎨 Elementor Compatible

Full Elementor support - export and import Elementor templates, page data, and Site Kit settings. Import complete Site Kits from elementor.json files with automatic activation. During import, automatically maps the front page, blog page, and activates the imported Elementor kit. Preserve all Elementor designs and configurations across sites.

🔌 Any Plugin Settings Import/Export

Export settings from ANY plugin with custom options support. Add custom plugin options via beautiful modal interface with JSON validation. Automatic detection of single-option plugins. Enhanced import/export with better error handling and logging.

🌐 Remote File Support

Import from remote URLs - no need to download files manually. Support for presigned URLs (Amazon S3, etc.) via filters. Local file support - use files from your theme directory.

🚀 Smart Import Interface

Predefined demo imports - theme authors can pre-configure imports. Manual ZIP upload - import your own exported files. Tabbed interface - easy switching between predefined and manual imports.

⚙️ Developer-Friendly

Comprehensive hooks and filters for customization. Before/after import actions for custom setup. WP-CLI commands for automated imports. Template function for theme integration.

User Guide

Complete guide for users to install, configure, and use Smart One Click Setup plugin.

Installation

Method 1: Install from WordPress.org

  1. Log in to your WordPress admin dashboard
  2. Navigate to Plugins → Add New
  3. In the search box, type "Smart One Click Setup"
  4. Click "Install Now" when you see the plugin
  5. After installation, click "Activate"

Note: This method requires your WordPress site to have internet access to download from the WordPress.org repository.

Method 2: Install from Direct Link/Download

  1. Download the plugin ZIP file from WordPress.org or your theme author
  2. Log in to your WordPress admin dashboard
  3. Navigate to Plugins → Add New
  4. Click "Upload Plugin" button at the top
  5. Click "Choose File" and select the downloaded ZIP file
  6. Click "Install Now"
  7. After installation, click "Activate Plugin"

Note: Make sure you upload the ZIP file, not extract it first. WordPress will extract it automatically.

Method 3: Manual Installation via FTP

  1. Download the plugin ZIP file
  2. Extract the ZIP file on your computer
  3. Connect to your website using FTP (FileZilla, etc.)
  4. Navigate to /wp-content/plugins/ directory
  5. Upload the extracted smart-one-click-setup folder
  6. Go to your WordPress admin → Plugins
  7. Find "Smart One Click Setup" and click "Activate"

After Activation

Once the plugin is activated, you will find:

  • Import page: Appearance → Import Demo Data
  • Export page: Appearance → Smart Export

How to Use

Importing Demo Content

  1. Go to Appearance → Import Demo Data
  2. If your theme has predefined demos, you'll see them listed
  3. Click on a demo to see details and preview
  4. Click "Import Demo" button
  5. Wait for the import process to complete
  6. The plugin automatically maps the front page, blog page, and activates imported Elementor kits
  7. After import, configure menus and other settings as needed

Smart Import Page:

Smart Import Page

Importing from ZIP File

  1. Go to Appearance → Import Demo Data
  2. Click on the "Upload ZIP File" tab (if available)
  3. Click "Choose File" and select your exported ZIP file
  4. Click "Upload and Import"
  5. The plugin will automatically detect and import all available data
  6. During import, the plugin automatically maps the front page, blog page, and activates imported Elementor kits

Import Complete:

Import Complete

Exporting Your Site Data

  1. Go to Appearance → Smart Export
  2. Select what you want to export:
    • Content (posts, pages, media)
    • Widgets
    • Customizer settings
    • Elementor data
    • Plugin settings (select from active plugins)
  3. Click "Export" button
  4. Download the generated ZIP file

Smart Export Page:

Smart Export Page

Export Complete:

Export Complete

Advanced Plugin Options

Custom Plugin Options Feature

NEW: Add custom plugin options for any selected plugin during export with full control over which options to include.

How to Add Custom Plugin Options
  1. Go to Appearance → Smart Export
  2. Select the plugins you want to export
  3. Click the Settings button (⚙️) next to any plugin name
  4. In the modal dialog, choose your option format:
JSON Array Format

Use this format to fetch option values from the database. The plugin will automatically retrieve the current values:

["option_name_1", "option_name_2", "option_name_3"]

Example:

["my_plugin_settings", "my_plugin_theme", "my_plugin_license"]
JSON Object Format

Use this format to specify custom values directly. The provided values will be used as-is:

{"option_name_1": "value1", "option_name_2": "value2"}

Example:

{"my_plugin_api_key": "your-api-key-here", "my_plugin_mode": "production"}

Features:

  • ✅ Beautiful modal interface with real-time JSON validation
  • ✅ Visual indicators (⚙️ icon) show which plugins have custom options
  • ✅ Seamless integration with existing plugin settings export
  • ✅ All custom options are saved and included in the export ZIP

Single-Option Plugin Detection

NEW: Automatic detection of plugins that store all settings in a single option with nested structure.

The plugin automatically detects plugins that use a single database option to store all their settings. This includes:

  • ✅ Smart option name detection (checks database for existing options)
  • ✅ Generic detection works for any plugin with nested structures
  • ✅ Automatic extraction of all nested settings

Examples of supported plugins:

  • Plugins that store all settings in plugin_name_settings option
  • Plugins with nested array structures
  • Any plugin following WordPress option patterns

Enhanced Import/Export Features

Improved Export:

  • ✅ Enhanced JSON encoding with proper Unicode and formatting support
  • ✅ Better error handling for JSON encoding failures
  • ✅ Widget export now uses proper widget_id as key for correct import
  • ✅ Visual indicators for plugins with custom options configured

Improved Import:

  • ✅ Enhanced logging shows imported option counts and names
  • ✅ Tracks all imported options even if values didn't change
  • ✅ Proper WordPress hooks triggering for all imported options
  • ✅ Improved unserialize handling for custom JSON values
  • ✅ Better error messages and validation feedback

Frequently Asked Questions

Where is the "Import Demo Data" page?

You will find the import page in wp-admin → Appearance → Import Demo Data.

Where are the demo import files and log files saved?

The files used in the demo import will be saved to the default WordPress uploads directory. An example of that directory would be: ../wp-content/uploads/2023/03/.

The log file will also be registered in the wp-admin → Media section, so you can access it easily.

Can I import from a ZIP file?

Yes! One ZIP file contains everything!

You can import from a single ZIP file containing all your exported data. The plugin automatically detects and imports everything available:

  1. Go to Appearance → Import Demo Data
  2. Click on the "Upload ZIP File" tab
  3. Upload your ZIP file
  4. The plugin will automatically extract and import all detected data

Is this plugin compatible with Elementor?

Yes! Full Elementor compatibility with Site Kit support!

This plugin provides complete Elementor support including:

  • ✅ Export and import Elementor templates and page data
  • NEW: Full Elementor Site Kit Import Support - import colors, typography, and global styles from elementor.json files
  • NEW: Automatically activates the imported Elementor kit during import
  • NEW: Automatically maps the front page during import
  • NEW: Automatically maps the blog page during import
  • ✅ Import Elementor page and template data with proper post ID mapping
  • ✅ Preserves all Elementor designs, CSS, and edit mode settings
  • ✅ Complete Elementor data import workflow - from export to import in one click
  • ✅ Seamless integration with Elementor Pro features
  • ✅ Enhanced compatibility - supports both export and import of complete Elementor configurations

Import Process: Elementor data is imported after content import to ensure proper post ID mapping and maintain all relationships. The plugin automatically handles front page mapping, blog page mapping, and Elementor kit activation - no manual setup required!

Can I export settings from any plugin?

Yes! Export settings from ANY plugin!

This plugin supports exporting settings from any WordPress plugin. It automatically detects all active plugins and shows them in a checklist for easy selection. All plugin settings are packaged in one ZIP file.

How long does the import process take?

The import time depends on the size of your demo content. Small demos may take 1-2 minutes, while larger demos with many images can take 5-10 minutes or more. The plugin will show progress during the import.

Will importing demo content delete my existing content?

No, importing demo content will add the demo content to your site. It will not delete your existing posts, pages, or media. However, if the demo includes content with the same titles or slugs, there may be conflicts.

Can I import multiple demos?

Yes, you can import multiple demos, but be aware that this may create duplicate content. It's recommended to import one demo at a time or reset your site between imports if you want a clean slate.

Developer Guide

This guide is for theme developers who want to integrate Smart One Click Setup into their themes. You can make any theme compatible with this plugin in just 15 minutes!

Basic Integration Generator NEW

Use our interactive code generator to quickly create custom integration code for your theme. Select the hooks and features you need, customize the code, and get ready-to-use code in seconds!

Plugin Safety Checks

Important: When using hooks and functions from this plugin in your theme or plugin, always ensure compatibility when Smart One Click Setup is not active/installed:

  • Native WordPress Hooks (SAFE): Using add_action() or add_filter() with plugin hooks is SAFE. They will be silently ignored if plugin isn't active.
  • Template Functions (REQUIRES CHECK): Always check function_exists() before calling template functions.
  • Plugin Classes (REQUIRES CHECK): Always check class_exists() before using plugin classes.
  • Recommended Pattern: Wrap integration code in plugin existence checks.

Example:

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/import_files', 'callback' );

//  SAFE - Always check first (prevents fatal error if plugin isn't active)
if ( function_exists( 'smartocs_display_smart_import' ) ) {
	smartocs_display_smart_import();
}

//  SAFE - Always check class exists before using
if ( class_exists( 'SMARTOCS\SmartOneClickSetup' ) ) {
	// Your integration code here
}

Quick Integration

Add this to your theme's functions.php to define demo imports:

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/predefined_import_files', function( $predefined_imports ) {
	// Optional: Check if plugin is still active
	if ( ! class_exists( 'SMARTOCS\SmartOneClickSetup' ) ) {
		return $predefined_imports;
	}
	
	return array(
		array(
			'name'          => 'Business Demo',
			'description'   => 'Perfect for business websites',
			'preview_image' => 'https://example.com/previews/business.jpg',
			'preview_url'   => 'https://example.com/demo/business',
			'zip_url'       => 'https://example.com/demos/business.zip',
		),
	);
} );

How to Integrate Code into Your Theme

Step 1: Open Your Theme's functions.php

Navigate to your theme directory and open functions.php. This file is typically located at:

/wp-content/themes/your-theme-name/functions.php

Step 2: Add Demo Import Code

Add the integration code at the end of your functions.php file. You can use any of the methods described below (Local Demo or Remote Demo).

Step 3: Add After Import Setup (Optional but Recommended)

Set up menus, homepage, and other settings after import:

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_action( 'smartocs/after_import', function( $selected_import ) {
	// Optional: Check if plugin is still active
	if ( ! class_exists( 'SMARTOCS\SmartOneClickSetup' ) ) {
		return;
	}
	
	$demo_name = isset( $selected_import['import_file_name'] ) 
		? $selected_import['import_file_name'] 
		: '';
	
	// Assign menus to locations
	$main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
	if ( $main_menu ) {
		set_theme_mod( 'nav_menu_locations', array(
			'primary' => $main_menu->term_id,
			'footer'  => $main_menu->term_id,
		) );
	}
	
	// Set front page
	$front_page = get_page_by_title( 'Home' );
	if ( $front_page ) {
		update_option( 'show_on_front', 'page' );
		update_option( 'page_on_front', $front_page->ID );
	}
	
	// Set blog page
	$blog_page = get_page_by_title( 'Blog' );
	if ( $blog_page ) {
		update_option( 'page_for_posts', $blog_page->ID );
	}
	
	// Conditional setup based on demo
	if ( 'Business Demo' === $demo_name ) {
		$business_menu = get_term_by( 'name', 'Business Menu', 'nav_menu' );
		if ( $business_menu ) {
			set_theme_mod( 'nav_menu_locations', array(
				'primary' => $business_menu->term_id,
			) );
		}
		set_theme_mod( 'custom_logo', attachment_url_to_postid( 
			get_template_directory_uri() . '/assets/images/logo-business.png' 
		) );
	} elseif ( 'Portfolio Demo' === $demo_name ) {
		$portfolio_menu = get_term_by( 'name', 'Portfolio Menu', 'nav_menu' );
		if ( $portfolio_menu ) {
			set_theme_mod( 'nav_menu_locations', array(
				'primary' => $portfolio_menu->term_id,
			) );
		}
	}
	
	flush_rewrite_rules();
	
	if ( function_exists( 'wp_cache_flush' ) ) {
		wp_cache_flush();
	}
} );

Local Demo Setup

If you want to bundle demo files directly with your theme, use local file paths.

Method 1: Using Filter with Local Path

add_filter( 'smartocs/predefined_import_files', function( $predefined_imports ) {
	return array(
		array(
			'name'          => 'Business Demo',
			'description'   => 'Perfect for business websites',
			'preview_image' => get_template_directory_uri() . '/demos/previews/business.jpg',
			'preview_url'   => 'https://example.com/demo/business',
			'zip_path'      => get_template_directory() . '/demos/business.zip',  // Local path
		),
		array(
			'name'          => 'Portfolio Demo',
			'description'   => 'Ideal for creative professionals',
			'preview_image' => get_template_directory_uri() . '/demos/previews/portfolio.jpg',
			'preview_url'   => 'https://example.com/demo/portfolio',
			'zip_path'      => get_template_directory() . '/demos/portfolio.zip',
		),
	);
} );

File Structure:

your-theme/
├── functions.php
└── demos/
    ├── business.zip
    ├── portfolio.zip
    └── previews/
        ├── business.jpg
        └── portfolio.jpg

Method 2: Using ImportHelper Class with Local Path

//  SAFE - Always check class exists before using (prevents fatal error if plugin isn't active)
use SMARTOCS\ImportHelper;

add_action( 'after_setup_theme', function() {
	//  SAFE - Check class exists before using
	if ( class_exists( '\SMARTOCS\ImportHelper' ) ) {
		\SMARTOCS\ImportHelper::add(
			'Business Demo',
			'',
			get_template_directory() . '/demos/business.zip',
			'Perfect for business websites',
			get_template_directory_uri() . '/demos/previews/business.jpg',
			'https://example.com/demo/business'
		);
	}
} );

Complete Local Demo Example

/**
 * Theme Name: My Awesome Theme
 * Smart One Click Setup - Local Demo Integration
 */

//  SAFE - Recommended: Wrap in plugin check for better practices
if ( class_exists( 'SMARTOCS\SmartOneClickSetup' ) ) {
	
	add_filter( 'smartocs/predefined_import_files', function( $predefined_imports ) {
		$theme_dir = get_template_directory();
		$theme_uri = get_template_directory_uri();
		
		return array(
			array(
				'name'          => 'Business Demo',
				'description'   => 'Perfect for business websites with modern design',
				'preview_image' => $theme_uri . '/demos/previews/business.jpg',
				'preview_url'   => 'https://demo.example.com/business',
				'zip_path'      => $theme_dir . '/demos/business.zip',
			),
			array(
				'name'          => 'Portfolio Demo',
				'description'   => 'Ideal for creative professionals and agencies',
				'preview_image' => $theme_uri . '/demos/previews/portfolio.jpg',
				'preview_url'   => 'https://demo.example.com/portfolio',
				'zip_path'      => $theme_dir . '/demos/portfolio.zip',
			),
		);
	} );

	add_action( 'smartocs/after_import', function( $selected_import ) {
		$main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
		if ( $main_menu ) {
			set_theme_mod( 'nav_menu_locations', array(
				'primary' => $main_menu->term_id,
			) );
		}
		
		$front_page = get_page_by_title( 'Home' );
		if ( $front_page ) {
			update_option( 'show_on_front', 'page' );
			update_option( 'page_on_front', $front_page->ID );
		}
	} );
	
}

Theme Integration Options

Display Smart Import in Your Theme

Use the smartocs_display_smart_import() function to display the import interface anywhere in your theme:

//  SAFE - Always check first (prevents fatal error if plugin isn't active)
// Basic usage
if ( function_exists( 'smartocs_display_smart_import' ) ) {
	smartocs_display_smart_import();
}

// With custom options
if ( function_exists( 'smartocs_display_smart_import' ) ) {
	smartocs_display_smart_import( array(
		'wrapper_class'          => 'my-custom-class',  // Custom CSS class for wrapper
		'show_header'             => false,  // Hide plugin header
		'show_sidebar'            => false,  // Hide theme card sidebar
		'load_plugin_css'         => false,  // Use theme styles
		'show_smart_import_tabs'  => false,  // Hide the tabs
		'show_file_upload_header' => false,  // Hide the file upload header
		'show_intro_text'         => false,  // Hide the intro text
	) );
}

// Return HTML instead of echoing
if ( function_exists( 'smartocs_display_smart_import' ) ) {
	$html = smartocs_display_smart_import( array( 'echo' => false ) );
}

Available Parameters:

  • echo (bool) - Whether to echo output or return it. Default: true
  • wrapper_class (string) - Additional CSS class for wrapper. Default: empty
  • show_header (bool) - Whether to show plugin header. Default: true
  • show_sidebar (bool) - Whether to show theme card sidebar. Default: true
  • load_plugin_css (bool) - Whether to load plugin CSS. Default: true
  • show_smart_import_tabs (bool) - Whether to show smart import tabs. Default: true
  • show_file_upload_header (bool) - Whether to show file upload header. Default: true
  • show_intro_text (bool) - Whether to show intro text. Default: true

Customize Intro Text

You can hide the intro text or customize it using filters:

Hide intro text via function argument:

smartocs_display_smart_import( array(
	'show_intro_text' => false,
) );

Hide intro text via filter:

add_filter( 'smartocs/show_intro_text', '__return_false' );

Replace with custom text:

add_filter( 'smartocs/intro_description_text', function( $description ) {
	return 'Your custom description text here. This will replace the default description.';
} );

Append additional text:

add_filter( 'smartocs/intro_description_text', function( $description ) {
	return $description . ' ' . 'Additional information can be added here.';
} );

Conditional text based on context:

add_filter( 'smartocs/intro_description_text', function( $description ) {
	if ( is_page( 'custom-import-page' ) ) {
		return 'Custom description for this specific page.';
	}
	return $description;
} );

HTML content (automatically sanitized):

add_filter( 'smartocs/intro_description_text', function( $description ) {
	return 'Bold text and italic text are allowed.';
} );

Hide Admin Menu

Hide the plugin's admin menu items while keeping all functionality:

// Disable admin menu items
add_filter( 'smartocs/disable_admin_menu', '__return_true' );

What this does:

  • ✅ Hides "Smart Import" and "Smart Export" from Appearance menu
  • ✅ Keeps all pages accessible via direct URL
  • ✅ Maintains all functionality (import, export, AJAX calls)
  • ✅ Allows integration into your own admin pages

Custom Admin Page Integration

Create your own admin page with the import interface:

// Step 1: Disable plugin menu
add_filter( 'smartocs/disable_admin_menu', '__return_true' );

// Step 2: Create custom admin page
function my_theme_setup_page() {
	add_theme_page(
		esc_html__( 'Theme Setup', 'textdomain' ),
		esc_html__( 'Theme Setup', 'textdomain' ),
		'manage_options',
		'my-theme-setup',
		'my_theme_setup_page_callback'
	);
}
add_action( 'admin_menu', 'my_theme_setup_page' );

// Step 3: Display Smart Import interface
function my_theme_setup_page_callback() {
	?>
	<div class="wrap">
		<h1><?php esc_html_e( 'Welcome to My Theme', 'textdomain' ); ?></h1>
		<p><?php esc_html_e( 'Get started by importing demo content:', 'textdomain' ); ?></p>
		
		<?php
		//  SAFE - Always check first (prevents fatal error if plugin isn't active)
		if ( function_exists( 'smartocs_display_smart_import' ) ) {
			smartocs_display_smart_import( array(
				'show_header'  => false,
				'show_sidebar' => false,
				'wrapper_class' => 'my-theme-custom-wrapper',
			) );
		} else {
			// Optional: Show notice if plugin isn't active
			if ( current_user_can( 'install_plugins' ) ) {
				?>
				<div class="notice notice-warning">
					<p>
						<?php
						printf(
							esc_html__( 'Please install and activate %s to use the demo import functionality.', 'textdomain' ),
							'<a href="' . esc_url( admin_url( 'plugin-install.php?s=smart+one+click+setup&tab=search&type=term' ) ) . '">Smart One Click Setup</a>'
						);
						?>
					</p>
				</div>
				<?php
			}
		}
		?>
	</div>
	<?php
}

Available Hooks

Action Hooks

Action hooks allow you to execute code at specific points during the import/export process. All action hooks are SAFE - they will be silently ignored if the plugin isn't active.

smartocs/before_content_import

Fired before content import starts. Useful for clearing caches or preparing the environment.

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_action( 'smartocs/before_content_import', function() {
	// Optional: Check if plugin is still active
	if ( ! class_exists( 'SMARTOCS\SmartOneClickSetup' ) ) {
		return;
	}
	delete_transient( 'my_theme_demo_cache' );
	error_log( 'Smart One Click Setup: Import started at ' . current_time( 'mysql' ) );
} );
smartocs/after_import

Fired after import is complete. Most commonly used for post-import setup (menus, homepage, etc.).

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_action( 'smartocs/after_import', function( $selected_import ) {
	// Optional: Check if plugin is still active
	if ( ! class_exists( 'SMARTOCS\SmartOneClickSetup' ) ) {
		return;
	}
	
	$demo_name = isset( $selected_import['import_file_name'] ) 
		? $selected_import['import_file_name'] 
		: '';
	
	$main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
	if ( $main_menu ) {
		set_theme_mod( 'nav_menu_locations', array(
			'primary' => $main_menu->term_id,
			'footer'  => $main_menu->term_id,
		) );
	}
	
	$front_page = get_page_by_title( 'Home' );
	if ( $front_page ) {
		update_option( 'show_on_front', 'page' );
		update_option( 'page_on_front', $front_page->ID );
	}
	
	$blog_page = get_page_by_title( 'Blog' );
	if ( $blog_page ) {
		update_option( 'page_for_posts', $blog_page->ID );
	}
	
	flush_rewrite_rules();
	
	if ( function_exists( 'wp_cache_flush' ) ) {
		wp_cache_flush();
	}
} );
smartocs/widget_importer_before_widgets_import

Fired before widgets are imported. Useful for clearing existing widgets.

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_action( 'smartocs/widget_importer_before_widgets_import', function() {
	$sidebars_widgets = get_option( 'sidebars_widgets', array() );
	foreach ( $sidebars_widgets as $sidebar => $widgets ) {
		if ( 'wp_inactive_widgets' !== $sidebar && 'array_version' !== $sidebar ) {
			$sidebars_widgets[ $sidebar ] = array();
		}
	}
	update_option( 'sidebars_widgets', $sidebars_widgets );
} );
smartocs/widget_importer_after_widgets_import

Fired after all widgets are imported. Useful for logging or additional widget setup.

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_action( 'smartocs/widget_importer_after_widgets_import', function() {
	error_log( 'Smart One Click Setup: Widgets imported successfully' );
} );
smartocs/plugin_page_header

Fired at the beginning of plugin pages. Useful for adding custom header content.

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_action( 'smartocs/plugin_page_header', function() {
	echo '

Custom header content goes here.

'; } );
smartocs/plugin_page_footer

Fired at the end of plugin pages. Useful for adding custom footer content.

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_action( 'smartocs/plugin_page_footer', function() {
	echo '

Custom footer content goes here.

'; } );

Filter Hooks

  • smartocs/predefined_import_files - Define predefined demo import files
  • smartocs/plugin_page_setup - Modify plugin page setup
  • smartocs/plugin_intro_text - Modify plugin intro text
  • smartocs/disable_admin_menu - Disable plugin admin menu items
  • smartocs/importer_options - Modify importer options
  • smartocs/import_memory_limit - Set memory limit for import process
  • smartocs/demo_api_base_url - Set remote API base URL
  • smartocs/show_smart_import_tabs - Show/hide smart import tabs conditionally
  • smartocs/show_file_upload_header - Show/hide file upload header conditionally
  • smartocs/show_intro_text - Show/hide intro text conditionally
  • smartocs/intro_description_text - Modify intro description text

For a complete list of all available hooks, see filter hooks.

Conditional Setup Based on Demo

Different setup for different demos:

//  SAFE - Recommended: Wrap in plugin check for better practices
if ( class_exists( 'SMARTOCS\SmartOneClickSetup' ) ) {
	
	add_action( 'smartocs/after_import', function( $selected_import ) {
		$demo_name = isset( $selected_import['import_file_name'] ) 
			? $selected_import['import_file_name'] 
			: '';
		
		if ( 'Business Demo' === $demo_name ) {
			$main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
			if ( $main_menu ) {
				set_theme_mod( 'nav_menu_locations', array(
					'primary' => $main_menu->term_id,
				) );
			}
			set_theme_mod( 'custom_logo', attachment_url_to_postid( 
				get_template_directory_uri() . '/assets/images/logo-business.png' 
			) );
		} 
		elseif ( 'Portfolio Demo' === $demo_name ) {
			$portfolio_menu = get_term_by( 'name', 'Portfolio Menu', 'nav_menu' );
			if ( $portfolio_menu ) {
				set_theme_mod( 'nav_menu_locations', array(
					'primary' => $portfolio_menu->term_id,
				) );
			}
		}
	} );
	
}

Using ImportHelper Class

Use the ImportHelper class for programmatic demo registration:

//  SAFE - Always check class exists (prevents fatal error if plugin isn't active)
use SMARTOCS\ImportHelper;

add_action( 'after_setup_theme', function() {
	//  SAFE - Check class exists before using
	if ( class_exists( '\SMARTOCS\ImportHelper' ) ) {
		\SMARTOCS\ImportHelper::add(
			'Business Demo',
			'',
			get_template_directory() . '/demos/business.zip',
			'Perfect for business websites',
			get_template_directory_uri() . '/demos/previews/business.jpg',
			'https://example.com/demo/business'
		);
	}
} );

Filter Hooks

Filter hooks allow you to modify data and settings throughout the import/export process. Here's a comprehensive list of all available filter hooks:

Quick Reference

Filter Hook Purpose
smartocs/predefined_import_files Define predefined demo import files
smartocs/import_files Define import files (legacy)
smartocs/pre_download_import_files Modify import file URLs before downloading
smartocs/importer_options Modify importer options
smartocs/import_memory_limit Set memory limit for import process
smartocs/plugin_page_setup Modify plugin page setup
smartocs/disable_admin_menu Disable plugin admin menu items
smartocs/demo_api_base_url Set remote API base URL
smartocs/show_smart_import_tabs Show/hide smart import tabs
smartocs/show_file_upload_header Show/hide file upload header
smartocs/show_intro_text Show/hide intro text
smartocs/intro_description_text Modify intro description text

Import Configuration Filters

smartocs/predefined_import_files

Purpose: Define predefined demo import files

Parameters: $predefined_imports (array)

Returns: Array of import file configurations

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/predefined_import_files', function( $predefined_imports ) {
	// Optional: Check if plugin is still active
	if ( ! class_exists( 'SMARTOCS\SmartOneClickSetup' ) ) {
		return $predefined_imports;
	}
	
	$theme_dir = get_template_directory();
	$theme_uri = get_template_directory_uri();
	
	return array(
		array(
			'name'          => 'Business Demo',
			'description'   => 'Perfect for business websites with modern design',
			'preview_image' => $theme_uri . '/demos/previews/business.jpg',
			'preview_url'   => 'https://demo.example.com/business',
			'zip_url'       => 'https://example.com/demos/business.zip',
		),
		array(
			'name'          => 'Portfolio Demo',
			'description'   => 'Ideal for creative professionals and agencies',
			'preview_image' => $theme_uri . '/demos/previews/portfolio.jpg',
			'preview_url'   => 'https://demo.example.com/portfolio',
			'zip_path'      => $theme_dir . '/demos/portfolio.zip',
		),
		array(
			'name'          => 'E-Commerce Demo',
			'description'   => 'Perfect for online stores',
			'preview_image' => $theme_uri . '/demos/previews/shop.jpg',
			'preview_url'   => 'https://demo.example.com/shop',
			'zip_url'       => 'https://example.com/demos/shop.zip',
		),
	);
} );

smartocs/import_files

Purpose: Define import files (legacy filter, use smartocs/predefined_import_files instead)

Parameters: $import_files (array)

Returns: Array of import file configurations

smartocs/pre_download_import_files

Purpose: Modify import file URLs before downloading (useful for presigned URLs)

Parameters: $import_file_info (array)

Returns: Modified import file information array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/pre_download_import_files', function( $import_file_info ) {
	if ( isset( $import_file_info['import_file_url'] ) ) {
		$import_file_info['import_file_url'] = add_query_arg(
			array(
				'auth_token' => 'your_token_here',
			),
			$import_file_info['import_file_url']
		);
	}
	return $import_file_info;
} );

Import Options Filters

smartocs/importer_options

Purpose: Modify importer options

Parameters: $options (array)

Returns: Modified options array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/importer_options', function( $options ) {
	$options['fetch_attachments'] = true;
	$options['authors'] = array(
		'admin' => get_current_user_id(),
	);
	return $options;
} );

smartocs/import_memory_limit

Purpose: Set memory limit for import process

Parameters: $memory_limit (string)

Returns: Memory limit string

Default: '350M'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/import_memory_limit', function( $memory_limit ) {
	return '512M';
} );

smartocs/set_time_limit_for_demo_data_import

Purpose: Set time limit for demo data import

Parameters: $time_limit (int) - Time limit in seconds

Returns: Modified time limit integer

Default: 300

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/set_time_limit_for_demo_data_import', function( $time_limit ) {
	return 600;
} );

smartocs/time_for_one_ajax_call

Purpose: Set time limit for one AJAX call during import

Parameters: $time (int) - Time in seconds

Returns: Modified time integer

Default: 25

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/time_for_one_ajax_call', function( $time ) {
	return 30;
} );

smartocs/regenerate_thumbnails_in_content_import

Purpose: Enable/disable thumbnail regeneration during content import

Parameters: None

Returns: Boolean

Default: true

Note: Disabling this will greatly improve import time but only original sized images will be imported

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/regenerate_thumbnails_in_content_import', '__return_false' );

UI and Display Filters

smartocs/plugin_page_setup

Purpose: Modify plugin page setup (location, title, etc.)

Parameters: $default_settings (array)

Returns: Modified settings array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/plugin_page_setup', function( $default_settings ) {
	$default_settings['parent_slug'] = 'themes.php';
	$default_settings['page_title']  = esc_html__( 'Import Demo Content', 'textdomain' );
	$default_settings['menu_title']  = esc_html__( 'Import Demo', 'textdomain' );
	$default_settings['capability']  = 'import';
	$default_settings['menu_slug']   = 'my-theme-import';
	return $default_settings;
} );

smartocs/plugin_page_title

Purpose: Modify plugin page title

Parameters: $plugin_title (string)

Returns: Modified title string

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/plugin_page_title', function( $plugin_title ) {
	return esc_html__( 'Custom Import Title', 'textdomain' );
} );

smartocs/plugin_page_display_callback_function

Purpose: Modify the callback function for displaying plugin page

Parameters: $callback (callable)

Returns: Modified callback function

smartocs/export_page_display_callback_function

Purpose: Modify the callback function for displaying export page

Parameters: $callback (callable)

Returns: Modified callback function

smartocs/plugin_intro_text

Purpose: Modify plugin intro text

Parameters: $default_text (string)

Returns: Modified intro text (HTML allowed)

// SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/plugin_intro_text', function( $default_text ) {
	$custom_text = '';
	$custom_text .= '<h2>' . esc_html__( 'Welcome to Our Theme!', 'textdomain' ) . '</h2>';
	$custom_text .= '<p>' . esc_html__( 'Import one of our pre-built demos to get started quickly.', 'textdomain' ) . '</p>';
	return $custom_text . $default_text;
} );

smartocs/disable_admin_menu

Purpose: Disable plugin admin menu items while keeping pages accessible

Parameters: $disable (bool)

Returns: Boolean

Default: false

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/disable_admin_menu', '__return_true' );

smartocs/show_export_link

Purpose: Show or hide the "Go to Smart Export" link

Parameters: $show (bool)

Returns: Boolean

Default: true

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/show_export_link', '__return_false' );

smartocs/show_smart_import_tabs

Purpose: Show or hide the smart import tabs conditionally

Parameters: $show_tabs (bool)

Returns: Boolean

Default: true

Example - Hide globally:

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/show_smart_import_tabs', '__return_false' );

Example - Conditional logic:

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/show_smart_import_tabs', function( $show_tabs ) {
	if ( is_page( 'custom-import-page' ) ) {
		return false;
	}
	if ( ! current_user_can( 'manage_options' ) ) {
		return false;
	}
	return $show_tabs;
} );

smartocs/show_file_upload_header

Purpose: Show or hide the file upload header conditionally

Parameters: $show (bool)

Returns: Boolean

Default: true

Example - Hide globally:

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/show_file_upload_header', '__return_false' );

Example - Conditional logic:

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/show_file_upload_header', function( $show ) {
	if ( is_page( 'custom-page' ) ) {
		return false;
	}
	return $show;
} );

smartocs/show_intro_text

Purpose: Show or hide the intro text conditionally

Parameters: $show (bool)

Returns: Boolean

Default: true

Example - Hide globally:

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/show_intro_text', '__return_false' );

smartocs/intro_description_text

Purpose: Modify or replace the intro description text

Parameters: $description (string)

Returns: Modified description text (HTML allowed, automatically sanitized)

Example - Replace with custom text:

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/intro_description_text', function( $description ) {
	return 'Your custom description text here.';
} );

Example - Append additional text:

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/intro_description_text', function( $description ) {
	return $description . ' ' . 'Additional information can be added here.';
} );

Example - Conditional text based on context:

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/intro_description_text', function( $description ) {
	if ( is_page( 'custom-import-page' ) ) {
		return 'Custom description for this specific page.';
	}
	return $description;
} );

Example - HTML content (automatically sanitized):

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/intro_description_text', function( $description ) {
	return 'Bold text and italic text are allowed.';
} );

smartocs/import_successful_buttons

Purpose: Modify buttons shown after successful import

Parameters: $buttons (array)

Returns: Modified buttons array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/import_successful_buttons', function( $buttons ) {
	$buttons[] = array(
		'label'  => esc_html__( 'View Site', 'textdomain' ),
		'class'  => 'button button-primary',
		'href'   => home_url(),
		'target' => '_blank',
	);
	$buttons[] = array(
		'label'  => esc_html__( 'Customize Theme', 'textdomain' ),
		'class'  => 'button button-secondary',
		'href'   => admin_url( 'customize.php' ),
		'target' => '_self',
	);
	return $buttons;
} );

smartocs/template_smart_import_args

Purpose: Modify arguments passed to smartocs_display_smart_import() function

Parameters: $args (array)

Returns: Modified arguments array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/template_smart_import_args', function( $args ) {
	$args['show_header'] = false;
	$args['show_sidebar'] = false;
	$args['wrapper_class'] = 'my-custom-wrapper-class';
	return $args;
} );

smartocs/template_smart_import_wrapper_classes

Purpose: Modify wrapper classes for Smart Import template

Parameters: $wrapper_classes (string), $args (array)

Returns: Modified wrapper classes string

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/template_smart_import_wrapper_classes', function( $wrapper_classes, $args ) {
	return $wrapper_classes . ' additional-class-here';
} );

smartocs/template_smart_import_output

Purpose: Modify the output HTML of Smart Import template

Parameters: $output (string), $args (array)

Returns: Modified output string

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/template_smart_import_output', function( $output, $args ) {
	return '
' . $output . '
'; } );

File Handling Filters

smartocs/timeout_for_downloading_import_file

Purpose: Modify timeout for downloading import files

Parameters: $timeout (int) - Timeout in seconds

Returns: Modified timeout integer

Default: 20

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/timeout_for_downloading_import_file', function( $timeout ) {
	return 60;
} );

smartocs/message_after_file_fetching_error

Purpose: Modify error message after file fetching fails

Parameters: $message (string)

Returns: Modified error message string

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/message_after_file_fetching_error', function( $message ) {
	return esc_html__( 'Custom error message when file fetching fails.', 'textdomain' );
} );

smartocs/upload_file_path

Purpose: Customize upload file path

Parameters: $path (string)

Returns: Modified path string

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/upload_file_path', function( $path ) {
	return trailingslashit( $path ) . 'custom-folder/';
} );

smartocs/upload_file_url

Purpose: Customize upload file URL

Parameters: $url (string)

Returns: Modified URL string

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/upload_file_url', function( $url ) {
	return trailingslashit( $url ) . 'custom-folder/';
} );

smartocs/file_mimes

Purpose: Modify allowed file MIME types

Parameters: $mimes (array)

Returns: Modified MIME types array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/file_mimes', function( $mimes ) {
	$mimes['zip'] = 'application/zip';
	return $mimes;
} );

smartocs/date_format_for_file_names

Purpose: Modify date format used in file names

Parameters: $format (string)

Returns: Modified date format string

Default: 'Y-m-d__H-i-s'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/date_format_for_file_names', function( $format ) {
	return 'Y-m-d_H-i-s';
} );

File Name Prefix/Suffix Filters

smartocs/downloaded_content_file_prefix

Purpose: Modify prefix for downloaded content file

Parameters: $prefix (string)

Returns: Modified prefix string

Default: 'demo-content-import-file_'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/downloaded_content_file_prefix', function( $prefix ) {
	return 'my-theme-content-';
} );

smartocs/downloaded_content_file_suffix_and_file_extension

Purpose: Modify suffix and extension for downloaded content file

Parameters: $suffix (string)

Returns: Modified suffix string

Default: '.xml'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/downloaded_content_file_suffix_and_file_extension', function( $suffix ) {
	return '.xml';
} );

smartocs/downloaded_widgets_file_prefix

Purpose: Modify prefix for downloaded widgets file

Parameters: $prefix (string)

Returns: Modified prefix string

Default: 'demo-widgets-import-file_'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/downloaded_widgets_file_prefix', function( $prefix ) {
	return 'my-theme-widgets-';
} );

smartocs/downloaded_widgets_file_suffix_and_file_extension

Purpose: Modify suffix and extension for downloaded widgets file

Parameters: $suffix (string)

Returns: Modified suffix string

Default: '.json'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/downloaded_widgets_file_suffix_and_file_extension', function( $suffix ) {
	return '.json';
} );

smartocs/downloaded_customizer_file_prefix

Purpose: Modify prefix for downloaded customizer file

Parameters: $prefix (string)

Returns: Modified prefix string

Default: 'demo-customizer-import-file_'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/downloaded_customizer_file_prefix', function( $prefix ) {
	return 'my-theme-customizer-';
} );

smartocs/downloaded_customizer_file_suffix_and_file_extension

Purpose: Modify suffix and extension for downloaded customizer file

Parameters: $suffix (string)

Returns: Modified suffix string

Default: '.dat'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/downloaded_customizer_file_suffix_and_file_extension', function( $suffix ) {
	return '.dat';
} );

smartocs/downloaded_redux_file_prefix

Purpose: Modify prefix for downloaded Redux file

Parameters: $prefix (string)

Returns: Modified prefix string

Default: 'demo-redux-import-file_'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/downloaded_redux_file_prefix', function( $prefix ) {
	return 'my-theme-redux-';
} );

smartocs/downloaded_redux_file_suffix_and_file_extension

Purpose: Modify suffix and extension for downloaded Redux file

Parameters: $suffix (string)

Returns: Modified suffix string

Default: '.json'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/downloaded_redux_file_suffix_and_file_extension', function( $suffix ) {
	return '.json';
} );

smartocs/downloaded_wpforms_file_prefix

Purpose: Modify prefix for downloaded WPForms file

Parameters: $prefix (string)

Returns: Modified prefix string

Default: 'demo-wpforms-import-file_'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/downloaded_wpforms_file_prefix', function( $prefix ) {
	return 'my-theme-wpforms-';
} );

smartocs/downloaded_wpforms_file_suffix_and_file_extension

Purpose: Modify suffix and extension for downloaded WPForms file

Parameters: $suffix (string)

Returns: Modified suffix string

Default: '.json'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/downloaded_wpforms_file_suffix_and_file_extension', function( $suffix ) {
	return '.json';
} );

smartocs/log_file_prefix

Purpose: Modify prefix for log file

Parameters: $prefix (string)

Returns: Modified prefix string

Default: 'log_file_'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/log_file_prefix', function( $prefix ) {
	return 'my-theme-log-';
} );

smartocs/log_file_suffix_and_file_extension

Purpose: Modify suffix and extension for log file

Parameters: $suffix (string)

Returns: Modified suffix string

Default: '.txt'

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/log_file_suffix_and_file_extension', function( $suffix ) {
	return '.txt';
} );

smartocs/attachment_prefix

Purpose: Modify prefix for attachment title

Parameters: $prefix (string)

Returns: Modified prefix string

Default: 'Smart One Click Setup - '

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/attachment_prefix', function( $prefix ) {
	return 'My Theme - ';
} );

Remote API Filters

smartocs/demo_api_base_url

Purpose: Set remote API base URL for automatic demo fetching

Parameters: None

Returns: Base URL string

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/demo_api_base_url', function() {
	return 'https://yourdomain.com/api';
} );

smartocs/demo_api_timeout

Purpose: Set timeout for API requests

Parameters: None

Returns: Timeout in seconds (integer)

Default: 15

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/demo_api_timeout', function() {
	return 30;
} );

smartocs/demo_api_cache_duration

Purpose: Set cache duration for API responses

Parameters: None

Returns: Cache duration in seconds (integer)

Default: 3600 (1 hour)

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/demo_api_cache_duration', function() {
	return 2 * HOUR_IN_SECONDS;
} );

smartocs/demo_api_sslverify

Purpose: Enable/disable SSL verification for API requests

Parameters: None

Returns: Boolean

Default: true

Warning: Only disable for development/testing

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/demo_api_sslverify', function() {
	return false;
} );

Widget Import Filters

smartocs/before_widgets_import_data

Purpose: Modify widget data before import

Parameters: $data (array)

Returns: Modified widget data array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/before_widgets_import_data', function( $data ) {
	if ( isset( $data['widgets'] ) && is_array( $data['widgets'] ) ) {
		foreach ( $data['widgets'] as $key => $widget ) {
		}
	}
	return $data;
} );

smartocs/widget_settings

Purpose: Modify widget settings object

Parameters: $widget (object)

Returns: Modified widget object

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/widget_settings', function( $widget ) {
	if ( isset( $widget->settings ) ) {
	}
	return $widget;
} );

smartocs/widget_settings_array

Purpose: Modify widget settings array

Parameters: $widget (array)

Returns: Modified widget array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/widget_settings_array', function( $widget ) {
	if ( isset( $widget['settings'] ) ) {
	}
	return $widget;
} );

smartocs/widget_import_results

Purpose: Modify widget import results

Parameters: $results (array)

Returns: Modified results array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/widget_import_results', function( $results ) {
	return $results;
} );

smartocs/available_widgets

Purpose: Modify list of available widgets

Parameters: $available_widgets (array)

Returns: Modified available widgets array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/available_widgets', function( $available_widgets ) {
	return $available_widgets;
} );

smartocs/enable_custom_menu_widget_ids_fix

Purpose: Enable/disable custom menu widget IDs fix

Parameters: None

Returns: Boolean

Default: true

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/enable_custom_menu_widget_ids_fix', '__return_false' );

Customizer Import Filters

smartocs/enable_wp_customize_save_hooks

Purpose: Enable WordPress customize save hooks during customizer import

Parameters: None

Returns: Boolean

Default: false

This enables: customize_save, customize_save_*, customize_save_after

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/enable_wp_customize_save_hooks', '__return_true' );

smartocs/customizer_import_images

Purpose: Enable/disable image import in customizer

Parameters: None

Returns: Boolean

Default: true

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/customizer_import_images', '__return_false' );

Export Filters

smartocs/export_options

Purpose: Modify export options

Parameters: $export_options (array)

Returns: Modified export options array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/export_options', function( $export_options ) {
	return $export_options;
} );

smartocs/export_content_args

Purpose: Modify arguments for content export

Parameters: $args (array)

Returns: Modified arguments array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/export_content_args', function( $args ) {
	$args['status'] = 'publish';
	return $args;
} );

smartocs/export_widget_data

Purpose: Modify widget data before export

Parameters: $widget_data (array)

Returns: Modified widget data array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/export_widget_data', function( $widget_data ) {
	return $widget_data;
} );

smartocs/export_customizer_data

Purpose: Modify customizer data before export

Parameters: $data (array)

Returns: Modified customizer data array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/export_customizer_data', function( $data ) {
	unset( $data['nav_menu_locations'] );
	return $data;
} );

smartocs/export_plugin_list

Purpose: Modify list of plugins available for export

Parameters: $plugin_list (array)

Returns: Modified plugin list array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/export_plugin_list', function( $plugin_list ) {
	$plugin_list[] = 'my-custom-plugin/my-custom-plugin.php';
	return $plugin_list;
} );

smartocs/export_plugin_settings_data

Purpose: Modify all plugin settings data before export

Parameters: $plugin_settings (array)

Returns: Modified plugin settings array

//  SAFE - Native WordPress hooks are safe (silently ignored if plugin isn't active)
add_filter( 'smartocs/export_plugin_settings_data', function( $plugin_settings ) {
	return $plugin_settings;
} );

smartocs/export_plugin_{$plugin_slug}_settings

Purpose: Modify settings for a specific plugin before export

Parameters: $settings (array)

Returns: Modified settings array

Example:

add_filter( 'smartocs/export_plugin_woocommerce_settings', function( $settings ) {
	// Modify WooCommerce settings
	return $settings;
} );

smartocs/export_elementor_data

Purpose: Modify Elementor data before export

Parameters: $elementor_data (array)

Returns: Modified Elementor data array

Logger Filters

smartocs/logger_options

Purpose: Modify logger options

Parameters: $options (array)

Returns: Modified options array

add_filter( 'smartocs/logger_options', function( $options ) {
	$options['logger_min_level'] = 'warning';  // 'warning', 'error', etc.
	return $options;
} );

Complete Filter Hooks Reference

This is a comprehensive list of all available filter hooks in Smart One Click Setup. For action hooks, see the Developer Guide section. For more detailed information about specific hooks, refer to the plugin source code or the Developer Guide.

Remote Demo Setup

Remote demo setup allows you to host your demo files on a remote server (like your own website, CDN, or cloud storage) instead of bundling them with your theme. This reduces theme size and allows you to update demos without releasing a new theme version.

Premium Solution

🚀 SmartOCS Cloud

Remote Demo Management Platform

A premium PHP script that empowers theme developers to manage their demo files remotely. Take full control of your theme demos without ever touching your theme code.

Manage demo imports remotely without theme updates
Update files and configurations from a central dashboard
Provide seamless experience for your theme users
Control demo availability and versions dynamically

Method 1: Remote URL Setup (Simple)

Use remote URLs to point to demo files hosted on your server:

add_filter( 'smartocs/predefined_import_files', function( $predefined_imports ) {
	return array(
		array(
			'name'          => 'Business Demo',
			'description'   => 'Perfect for business websites',
			'preview_image' => 'https://yourdomain.com/demos/previews/business.jpg',
			'preview_url'   => 'https://demo.yourdomain.com/business',
			'zip_url'       => 'https://yourdomain.com/demos/business.zip',  // Remote URL
		),
		array(
			'name'          => 'Portfolio Demo',
			'description'   => 'Ideal for creative professionals',
			'preview_image' => 'https://yourdomain.com/demos/previews/portfolio.jpg',
			'preview_url'   => 'https://demo.yourdomain.com/portfolio',
			'zip_url'       => 'https://yourdomain.com/demos/portfolio.zip',
		),
	);
} );

Benefits:

  • ✅ Smaller theme package size
  • ✅ Easy to update demos without theme updates
  • ✅ Can host on CDN for faster downloads
  • ✅ No need to include large ZIP files in theme

Method 2: Remote API Integration (Automatic)

The easiest way for theme authors! Just set a base URL and the plugin automatically fetches demos based on your theme name.

Basic API Setup

// In your theme's functions.php
add_filter( 'smartocs/demo_api_base_url', function() {
	return 'https://yourdomain.com';
} );

How it works:

  1. Plugin detects your theme name (e.g., "zenix")
  2. Constructs API URL: https://yourdomain.com/zenix/demos.json
  3. Fetches and parses the JSON file
  4. Automatically registers all demos found

API JSON Format

Your demos.json file should return one of these formats:

Format 1: Direct array

[
	{
		"name": "Business Demo",
		"zip_url": "https://yourdomain.com/zenix/demos/business.zip",
		"description": "Perfect for business websites",
		"preview_image": "https://yourdomain.com/zenix/previews/business.jpg",
		"preview_url": "https://demo.yourdomain.com/zenix/business"
	},
	{
		"name": "Portfolio Demo",
		"zip_url": "https://yourdomain.com/zenix/demos/portfolio.zip",
		"description": "Great for showcasing work",
		"preview_image": "https://yourdomain.com/zenix/previews/portfolio.jpg",
		"preview_url": "https://demo.yourdomain.com/zenix/portfolio"
	}
]

Format 2: Wrapped in 'demos' key

{
	"demos": [
		{
			"name": "Business Demo",
			"zip_url": "https://yourdomain.com/zenix/demos/business.zip"
		}
	]
}

Format 3: Wrapped in 'data' key

{
	"data": [
		{
			"name": "Business Demo",
			"zip_url": "https://yourdomain.com/zenix/demos/business.zip"
		}
	]
}

Custom API Endpoint

If your API uses a different endpoint (not demos.json):

use SMARTOCS\ImportHelper;

add_action( 'after_setup_theme', function() {
	// Set base URL via filter
	add_filter( 'smartocs/demo_api_base_url', function() {
		return 'https://yourdomain.com';
	} );
	
	// Fetch with custom endpoint
	ImportHelper::fetch_from_api( '', '', 'api/demos.php' );
} );

Manual API Fetch

You can also manually trigger API fetch:

use SMARTOCS\ImportHelper;

add_action( 'after_setup_theme', function() {
	$result = ImportHelper::fetch_from_api(
		'https://yourdomain.com',  // Base URL
		'zenix',                    // Theme name (optional, auto-detected)
		'demos.json'                // API endpoint (optional, default: demos.json)
	);
	
	if ( is_wp_error( $result ) ) {
		// Handle error
		error_log( $result->get_error_message() );
	}
} );

Method 3: Using ImportHelper Class

Use the ImportHelper class for a more programmatic approach:

use SMARTOCS\ImportHelper;

add_action( 'after_setup_theme', function() {
	// Add single remote demo
	ImportHelper::add(
		'Business Demo',                                    // Name
		'https://yourdomain.com/demos/business.zip',      // Remote URL
		'',                                                // Local path (empty for remote)
		'Perfect for business websites',                    // Description
		'https://yourdomain.com/previews/business.jpg',   // Preview image
		'https://demo.yourdomain.com/business'            // Preview URL
	);
	
	// Add multiple remote demos
	ImportHelper::add_multiple( array(
		'https://yourdomain.com/demos/demo1.zip',
		'https://yourdomain.com/demos/demo2.zip',
		'https://yourdomain.com/demos/demo3.zip',
	) );
} );

API Configuration Options

Custom Timeout

// Custom timeout (default: 15 seconds)
add_filter( 'smartocs/demo_api_timeout', function() {
	return 30; // 30 seconds
} );

Custom Cache Duration

// Custom cache duration (default: 1 hour)
add_filter( 'smartocs/demo_api_cache_duration', function() {
	return 2 * HOUR_IN_SECONDS; // Cache for 2 hours
} );

SSL Verification

// Disable SSL verification (not recommended for production)
add_filter( 'smartocs/demo_api_sslverify', function() {
	return false;
} );

Warning: Only use this for development/testing. Disabling SSL verification can be a security risk.

Presigned URLs (Amazon S3, etc.)

If you want to host your import content files on Amazon S3 using presigned URLs (temporary links), you can use the smartocs/pre_download_import_files filter:

add_filter( 'smartocs/pre_download_import_files', function( $import_file_info ) {
	// Get presigned URLs from your API
	$request = get_my_custom_urls( $import_file_info );
	
	if ( ! is_wp_error( $request ) ) {
		if ( isset( $request['data'] ) && is_array( $request['data'] ) ) {
			if ( isset( $request['data']['import_file_url'] ) && $import_file_url = $request['data']['import_file_url'] ) {
				$import_file_info['import_file_url'] = $import_file_url;
			}
			if ( isset( $request['data']['import_widget_file_url'] ) && $import_widget_file_url = $request['data']['import_widget_file_url'] ) {
				$import_file_info['import_widget_file_url'] = $import_widget_file_url;
			}
			if ( isset( $request['data']['import_customizer_file_url'] ) && $import_customizer_file_url = $request['data']['import_customizer_file_url'] ) {
				$import_file_info['import_customizer_file_url'] = $import_customizer_file_url;
			}
		}
	}
	
	return $import_file_info;
} );

This is useful when you need temporary, secure URLs for your demo files.

Complete Remote Demo Example

/**
 * Theme Name: My Awesome Theme
 * Smart One Click Setup - Remote Demo Integration
 */

//  SAFE - Recommended: Wrap in plugin check for better practices
if ( class_exists( 'SMARTOCS\SmartOneClickSetup' ) ) {
	
	add_filter( 'smartocs/predefined_import_files', function( $predefined_imports ) {
		return array(
			array(
				'name'          => 'Business Demo',
				'description'   => 'Perfect for business websites',
				'preview_image' => 'https://example.com/previews/business.jpg',
				'preview_url'   => 'https://example.com/demo/business',
				'zip_url'       => 'https://example.com/demos/business.zip',
			),
		);
	} );

	add_action( 'smartocs/after_import', function( $selected_import ) {
		$main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
		if ( $main_menu ) {
			set_theme_mod( 'nav_menu_locations', array(
				'primary' => $main_menu->term_id,
			) );
		}
		
		$front_page = get_page_by_title( 'Home' );
		if ( $front_page ) {
			update_option( 'show_on_front', 'page' );
			update_option( 'page_on_front', $front_page->ID );
		}
		
		$blog_page = get_page_by_title( 'Blog' );
		if ( $blog_page ) {
			update_option( 'page_for_posts', $blog_page->ID );
		}
	} );
	
}

Best Practices for Remote Demos

  • Use HTTPS: Always use HTTPS URLs for security
  • CDN Hosting: Consider hosting demo files on a CDN for faster downloads
  • File Organization: Organize your files logically (e.g., /demos/{theme-name}/)
  • Version Control: Include version numbers in filenames if you update demos
  • Error Handling: Always handle cases where remote files might be unavailable
  • Caching: Use appropriate cache durations to balance freshness and performance

Basic Integration Generator

Select the hooks and features you need, customize the code, and generate ready-to-use integration code for your WordPress theme.

🚀 Need More Advanced Features?

SmartOCS Cloud comes with a Pro Code Generator that includes advanced features like remote API code generation, presigned URLs, and more sophisticated integration patterns. Perfect for developers who need comprehensive remote demo management solutions.

Select Hooks & Features

Quick Start

Action Hooks

Import Configuration

UI & Display

Generated Code

// Select hooks and features above, then click "Generate Code"

Troubleshooting

This section covers common errors and issues you might encounter when using Smart One Click Setup.

Common Errors

Fatal Error on Activation

Error Message: "Plugin could not be activated because it triggered a fatal error"

Cause: Your hosting server is using a very old version of PHP.

Solution:

  • This plugin requires PHP version of at least 7.4, but we recommend version 8.0 or higher
  • Contact your hosting company and ask them to update the PHP version for your site
  • You can check your current PHP version in WordPress admin under Tools → Site Health → Info

Import Fails or Times Out

Error Message: Import process stops or times out

Possible Causes & Solutions:

  • Large demo files: Increase PHP memory limit and execution time
    // Add to wp-config.php
    define( 'WP_MEMORY_LIMIT', '512M' );
    define( 'WP_MAX_MEMORY_LIMIT', '512M' );
    @ini_set( 'max_execution_time', '300' );
  • Server timeout: Contact your host to increase timeout limits
  • Network issues: Check if remote URLs are accessible
  • File permissions: Ensure WordPress uploads directory is writable

Remote File Download Fails

Error Message: "Failed to download import file" or similar

Possible Causes & Solutions:

  • Invalid URL: Verify the URL is correct and accessible
  • SSL Certificate issues: Check if the URL uses valid SSL certificate
  • Server restrictions: Some hosts block external file downloads
    // Temporarily disable SSL verification (development only)
    add_filter( 'smartocs/demo_api_sslverify', '__return_false' );
  • File size limits: Check if file exceeds server upload limits
  • Timeout: Increase download timeout
    add_filter( 'smartocs/timeout_for_downloading_import_file', function( $timeout ) {
    	return 60; // 60 seconds
    } );

Memory Limit Exceeded

Error Message: "Fatal error: Allowed memory size exhausted"

Solution:

  • Increase PHP memory limit in wp-config.php:
    define( 'WP_MEMORY_LIMIT', '512M' );
    define( 'WP_MAX_MEMORY_LIMIT', '512M' );
  • Or use the filter:
    add_filter( 'smartocs/import_memory_limit', function( $memory_limit ) {
    	return '512M';
    } );

Images Not Importing

Issue: Content imports but images are missing

Possible Causes & Solutions:

  • External images blocked: Check if fetch_attachments is enabled
    add_filter( 'smartocs/importer_options', function( $options ) {
    	$options['fetch_attachments'] = true;
    	return $options;
    } );
  • File permissions: Ensure uploads directory is writable
  • Timeout: Large image imports may need more time

Menus Not Assigned After Import

Issue: Content imports but menus aren't assigned to locations

Solution: Use the smartocs/after_import hook to assign menus:

add_action( 'smartocs/after_import', function( $selected_import ) {
	$main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
	if ( $main_menu ) {
		set_theme_mod( 'nav_menu_locations', array(
			'primary' => $main_menu->term_id,
		) );
	}
} );

Homepage Not Set After Import

Issue: Content imports but homepage isn't set

Solution: Use the smartocs/after_import hook to set homepage:

add_action( 'smartocs/after_import', function( $selected_import ) {
	$front_page = get_page_by_title( 'Home' );
	if ( $front_page ) {
		update_option( 'show_on_front', 'page' );
		update_option( 'page_on_front', $front_page->ID );
	}
} );

API Not Fetching Demos

Issue: Remote API integration not working

Possible Causes & Solutions:

  • Incorrect theme name: Verify theme name matches API structure
  • API URL incorrect: Check the base URL and endpoint
  • JSON format: Verify JSON is valid and in correct format
  • Caching: Clear cache or reduce cache duration for testing
    add_filter( 'smartocs/demo_api_cache_duration', function() {
    	return 0; // No cache for testing
    } );
  • Network issues: Test API URL directly in browser

Local Demo Files Not Found

Issue: Local demo files not loading

Possible Causes & Solutions:

  • Incorrect path: Use get_template_directory() for absolute paths
    // Correct
    'zip_path' => get_template_directory() . '/demos/demo.zip',
    
    // Incorrect
    'zip_path' => '/demos/demo.zip',
  • File permissions: Ensure files are readable
  • File doesn't exist: Verify file exists at specified path

Debugging Tips

Enable Debug Mode

Add to wp-config.php:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Check /wp-content/debug.log for error messages.

Check Import Logs

Import logs are saved in the WordPress uploads directory and can be accessed via:

  • Media Library: Log files appear in wp-admin → Media
  • Uploads Directory: Check /wp-content/uploads/ for log files

Test Remote URLs

Before using remote URLs, test them:

  • Open the URL directly in a browser
  • Check if the file downloads correctly
  • Verify file size and format
  • Test with curl or wget from command line

Getting Help

If you're still experiencing issues:

  • Check the GitHub repository for known issues
  • Review the Developer Guide for detailed documentation
  • Check WordPress debug logs for specific error messages
  • Verify your server meets the minimum requirements (PHP 7.4+, WordPress 5.5+)