示例#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);
    }
}
示例#2
0
/**
* Install script to create database tables and then insert default data.
* Only run if theme is being activated.
*
*
*/
function cp_install_theme()
{
    global $wpdb, $app_abbr, $app_db_version, $wp_rewrite;
    // 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();
    // flush the rewrite rules, triggered in admin-post-types.php
    update_option($app_abbr . '_rewrite_flush_flag', 'true');
    // if fresh install, setup current database version, and do not process update
    if (get_option($app_abbr . '_db_version') == false) {
        update_option($app_abbr . '_db_version', $app_db_version);
    }
}