PluginProbe
Fable Extra / trunk
Fable Extra vtrunk
1.0.13 trunk 1.0.10 1.0.11 1.0.12 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
fable-extra / inc / fable-extra-activator.php

fable-extra-activator.php in Fable Extra trunk, at inc/fable-extra-activator.php

58 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Fired during plugin Activation
4 *
5 * @package Fable Extra
6 */
7
8 /**
9 * This class defines all code necessary to run during the plugin's activation.
10 *
11 */
12 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
13 class fable_extra_Activator {
14
15 public static function activate() {
16
17 $item_details_page = get_option('item_details_page');
18 $fable_current_theme = wp_get_theme(); // gets the current theme
19 if(!$item_details_page){
20 if( 'Shopire' == $fable_current_theme->name || 'MiniCart' == $fable_current_theme->name || 'EazyShop' == $fable_current_theme->name || 'EasyBuy' == $fable_current_theme->name || 'eKart' == $fable_current_theme->name || 'ShopWay' == $fable_current_theme->name || 'BuyCart' == $fable_current_theme->name || 'eShopKit' == $fable_current_theme->name || 'ShopZone' == $fable_current_theme->name){
21 require WPFE_PATH .'inc/themes/shopire/fresh-site-data/media.php';
22 require WPFE_PATH .'inc/themes/shopire/fresh-site-data/widget.php';
23 }
24 $pages = array( esc_html__( 'Home', 'fable-extra' ), esc_html__( 'Blog', 'fable-extra' ) );
25 foreach ($pages as $page){
26 $post_data = array( 'post_author' => 1, 'post_name' => $page, 'post_status' => 'publish' , 'post_title' => $page, 'post_type' => 'page', );
27 if($page== 'Home'):
28 $page_option = 'page_on_front';
29 $template = 'page-templates/frontpage.php';
30 else:
31 $page_option = 'page_for_posts';
32 $template = 'page.php';
33 endif;
34 $post_data = wp_insert_post( $post_data, false );
35 if ( $post_data ){
36 update_post_meta( $post_data, '_wp_page_template', $template );
37 $page = new WP_Query(
38 array(
39 'post_type' => 'page',
40 'title' => $page,
41 'posts_per_page' => 1,
42 'no_found_rows' => true,
43 'ignore_sticky_posts' => true,
44 'update_post_term_cache' => false,
45 'update_post_meta_cache' => false,
46 )
47 );
48 update_option( 'show_on_front', 'page' );
49 update_option( $page_option, $page->post->ID );
50 }
51 }
52
53 update_option( 'item_details_page', 'Done' );
54
55 }
56 }
57
58 }