| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: SpiceBox |
| 4 |
Plugin URI: |
| 5 |
Description: Enhances Spicethemes with extra functionality. |
| 6 |
Version: 0.2.2 |
| 7 |
Author: Spicethemes |
| 8 |
Author URI: https://github.com |
| 9 |
Text Domain: spicebox |
| 10 |
*/ |
| 11 |
define( 'SPICEB_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 12 |
define( 'SPICEB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 13 |
|
| 14 |
function spiceb_activate() { |
| 15 |
$theme = wp_get_theme(); // gets the current theme |
| 16 |
if ( 'SpicePress' == $theme->name ){ |
| 17 |
require_once('inc/spicepress/features/feature-slider-section.php'); |
| 18 |
require_once('inc/spicepress/features/feature-service-section.php'); |
| 19 |
require_once('inc/spicepress/features/feature-portfolio-section.php'); |
| 20 |
require_once('inc/spicepress/features/feature-testimonial-section.php'); |
| 21 |
require_once('inc/spicepress/sections/spicepress-slider-section.php'); |
| 22 |
require_once('inc/spicepress/sections/spicepress-features-section.php'); |
| 23 |
require_once('inc/spicepress/sections/spicepress-portfolio-section.php'); |
| 24 |
require_once('inc/spicepress/sections/spicepress-testimonail-section.php'); |
| 25 |
require_once('inc/spicepress/customizer.php'); |
| 26 |
|
| 27 |
} |
| 28 |
|
| 29 |
} |
| 30 |
add_action( 'init', 'spiceb_activate' ); |
| 31 |
|
| 32 |
|
| 33 |
$theme = wp_get_theme(); |
| 34 |
if ( 'SpicePress' == $theme->name ){ |
| 35 |
|
| 36 |
|
| 37 |
register_activation_hook( __FILE__, 'spiceb_install_function'); |
| 38 |
function spiceb_install_function() |
| 39 |
{ |
| 40 |
$item_details_page = get_option('item_details_page'); |
| 41 |
if(!$item_details_page){ |
| 42 |
//post status and options |
| 43 |
$post = array( |
| 44 |
'comment_status' => 'closed', |
| 45 |
'ping_status' => 'closed' , |
| 46 |
'post_author' => 1, |
| 47 |
'post_date' => date('Y-m-d H:i:s'), |
| 48 |
'post_name' => 'Home', |
| 49 |
'post_status' => 'publish' , |
| 50 |
'post_title' => 'Home', |
| 51 |
'post_type' => 'page', |
| 52 |
); |
| 53 |
//insert page and save the id |
| 54 |
$newvalue = wp_insert_post( $post, false ); |
| 55 |
if ( $newvalue && ! is_wp_error( $newvalue ) ){ |
| 56 |
update_post_meta( $newvalue, '_wp_page_template', 'template-business.php' ); |
| 57 |
|
| 58 |
// Use a static front page |
| 59 |
$page = get_page_by_title('Home'); |
| 60 |
update_option( 'show_on_front', 'page' ); |
| 61 |
update_option( 'page_on_front', $page->ID ); |
| 62 |
|
| 63 |
} |
| 64 |
//save the id in the database |
| 65 |
update_option( 'item_details_page', $newvalue ); |
| 66 |
} |
| 67 |
} |
| 68 |
|
| 69 |
} |
| 70 |
?> |