| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: SpiceBox |
| 4 |
Plugin URI: |
| 5 |
Description: Enhances SpiceThemes with extra functionality. |
| 6 |
Version: 0.2.8 |
| 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_spicepress_feedback_scripts() { |
| 15 |
wp_register_script('spiceb-custom-script', SPICEB_PLUGIN_URL. '/inc/js/custom-js.js',array('jquery','wp-color-picker'),'1.1', true); |
| 16 |
wp_enqueue_script('spiceb-custom-script'); |
| 17 |
wp_enqueue_style('spiceb_style',SPICEB_PLUGIN_URL.'inc/css/feedback-popup.css'); |
| 18 |
} |
| 19 |
add_action( 'admin_enqueue_scripts', 'spiceb_spicepress_feedback_scripts' ); |
| 20 |
|
| 21 |
function spiceb_activate() { |
| 22 |
$theme = wp_get_theme(); // gets the current theme |
| 23 |
if ( 'SpicePress' == $theme->name || 'Rockers' == $theme->name || 'Content' == $theme->name || 'Certify' == $theme->name || 'Stacy' == $theme->name || 'SpicePress Child Theme' == $theme->name){ |
| 24 |
require_once('inc/spicepress/features/feature-slider-section.php'); |
| 25 |
require_once('inc/spicepress/features/feature-service-section.php'); |
| 26 |
require_once('inc/spicepress/features/feature-portfolio-section.php'); |
| 27 |
require_once('inc/spicepress/features/feature-testimonial-section.php'); |
| 28 |
require_once('inc/spicepress/sections/spicepress-slider-section.php'); |
| 29 |
require_once('inc/spicepress/sections/spicepress-features-section.php'); |
| 30 |
require_once('inc/spicepress/sections/spicepress-portfolio-section.php'); |
| 31 |
require_once('inc/spicepress/sections/spicepress-testimonail-section.php'); |
| 32 |
require_once('inc/spicepress/customizer.php'); |
| 33 |
|
| 34 |
} |
| 35 |
|
| 36 |
} |
| 37 |
add_action( 'init', 'spiceb_activate' ); |
| 38 |
|
| 39 |
|
| 40 |
$theme = wp_get_theme(); |
| 41 |
if ( 'SpicePress' == $theme->name || 'Rockers' == $theme->name || 'Content' == $theme->name || 'Certify' == $theme->name || 'Stacy' == $theme->name || 'SpicePress Child Theme' == $theme->name){ |
| 42 |
|
| 43 |
|
| 44 |
register_activation_hook( __FILE__, 'spiceb_install_function'); |
| 45 |
function spiceb_install_function() |
| 46 |
{ |
| 47 |
$item_details_page = get_option('item_details_page'); |
| 48 |
if(!$item_details_page){ |
| 49 |
//post status and options |
| 50 |
$post = array( |
| 51 |
'comment_status' => 'closed', |
| 52 |
'ping_status' => 'closed' , |
| 53 |
'post_author' => 1, |
| 54 |
'post_date' => date('Y-m-d H:i:s'), |
| 55 |
'post_name' => 'Home', |
| 56 |
'post_status' => 'publish' , |
| 57 |
'post_title' => 'Home', |
| 58 |
'post_type' => 'page', |
| 59 |
); |
| 60 |
//insert page and save the id |
| 61 |
$newvalue = wp_insert_post( $post, false ); |
| 62 |
if ( $newvalue && ! is_wp_error( $newvalue ) ){ |
| 63 |
update_post_meta( $newvalue, '_wp_page_template', 'template-business.php' ); |
| 64 |
|
| 65 |
// Use a static front page |
| 66 |
$page = get_page_by_title('Home'); |
| 67 |
update_option( 'show_on_front', 'page' ); |
| 68 |
update_option( 'page_on_front', $page->ID ); |
| 69 |
|
| 70 |
} |
| 71 |
//save the id in the database |
| 72 |
update_option( 'item_details_page', $newvalue ); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
} |
| 77 |
|
| 78 |
if ('SpicePress' == $theme->name || 'Rockers' == $theme->name || 'Content' == $theme->name || 'Certify' == $theme->name || 'Stacy' == $theme->name || 'SpicePress Child Theme' == $theme->name) |
| 79 |
{ |
| 80 |
add_action( 'switch_theme', 'spicepresstheme_deactivate_message' ); |
| 81 |
function spicepresstheme_deactivate_message() |
| 82 |
{ |
| 83 |
$theme = wp_get_theme(); |
| 84 |
if($theme->template!='spicepress'){ |
| 85 |
require_once('inc/feedback-pop-up-form.php'); |
| 86 |
} |
| 87 |
|
| 88 |
} |
| 89 |
} |
| 90 |
?> |