Example #1
0
/**
 * Install script to create database tables and then insert default data.
 * Only run if theme is being activated.
 *
 */
function cp_install_theme()
{
    // run the table install script
    cp_tables_install();
    // populate the database tables
    cp_populate_tables();
    // insert the default values
    cp_default_values();
    // create pages and assign templates
    cp_create_pages();
    // create a default ad and category
    cp_default_ad();
    // create the default menus
    cp_default_menus();
    // assign default widgets to sidebars
    cp_default_widgets();
    // flush the rewrite rules
    flush_rewrite_rules();
    // if fresh install, setup current database version, and do not process update
    if (get_option('cp_db_version') == false) {
        // set blog and ads pages
        update_option('show_on_front', 'page');
        update_option('page_on_front', CP_Ads_Home::get_id());
        update_option('page_for_posts', CP_Blog_Archive::get_id());
        update_option('cp_db_version', CP_DB_VERSION);
    }
}
Example #2
0
/**
 * Execute changes made in ClassiPress 3.3.
 *
 * @since 3.3
 */
function cp_upgrade_330()
{
    // convert and remove legacy meta
    cp_upgrade_legacy_meta_293();
    // convert all expire dates to format 'Y-m-d H:i:s'
    $args = array('post_type' => APP_POST_TYPE, 'post_status' => 'any', 'posts_per_page' => -1, 'fields' => 'ids', 'meta_query' => array(array('key' => 'cp_sys_expire_date', 'value' => '', 'compare' => '!=')));
    $legacy = new WP_Query($args);
    if (isset($legacy->posts) && is_array($legacy->posts)) {
        foreach ($legacy->posts as $post_id) {
            $expire_time = strtotime(get_post_meta($post_id, 'cp_sys_expire_date', true));
            $expire_date = date('Y-m-d H:i:s', $expire_time);
            update_post_meta($post_id, 'cp_sys_expire_date', $expire_date);
        }
    }
    // change default for search field width option
    if (get_option('cp_search_field_width') == '450px') {
        update_option('cp_search_field_width', '');
    }
    // convert coupons to format of AppThemes Coupons plugin
    cp_upgrade_coupons_330();
    // convert transactions to format of new AppThemes Payments
    cp_upgrade_transactions_330();
    // convert old settings to scbOptions format
    cp_upgrade_settings_330();
    // set blog and ads pages
    update_option('show_on_front', 'page');
    update_option('page_on_front', CP_Ads_Home::get_id());
    update_option('page_for_posts', CP_Blog_Archive::get_id());
    // remove old blog page
    $args = array('post_type' => 'page', 'meta_key' => '_wp_page_template', 'meta_value' => 'tpl-blog.php', 'posts_per_page' => 1, 'suppress_filters' => true);
    $blog_page = new WP_Query($args);
    if (!empty($blog_page->posts)) {
        wp_delete_post($blog_page->posts[0]->ID, true);
    }
    update_option('cp_db_version', '1960');
}
Example #3
0
 function __construct()
 {
     self::$_template = 'tpl-ads-home.php';
     parent::__construct(self::$_template, __('Ad Listings', APP_TD));
 }