The MU forums have moved to WordPress.org

Problem with default pages and default link categories (3 posts)

  1. mvkozyrev
    Member
    Posted 14 years ago #

    I need automatycaly creation of 2 default pages (one standart page and one with adress like http://new_blog.my_site.ru/some_page.php when some_page.php is the file with template) and 2 default link categories within new glog creating.

    I found functions in the wp-includes/wpmu-functions.php. But But I did not get a my idea to do that :(

    Please, help.

    '// First page
    $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ('$user_id', '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'publish', 'page', '', '', '')");
    // Flush rules to pick up the new page.
    $wp_rewrite->init();
    $wp_rewrite->flush_rules();'

    '// Default link category
    $cat_name = $wpdb->escape(__('Blogroll'));
    $cat_slug = sanitize_title(__('Blogroll'));
    $blogroll_id = $wpdb->get_var( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = '$cat_slug'" );
    if( $blogroll_id == null ) {
    $wpdb->query( "INSERT INTO " . $wpdb->sitecategories . " (cat_ID, cat_name, category_nicename, last_updated) VALUES (0, '$cat_name', '$cat_slug', NOW())" );
    $blogroll_id = $wpdb->insert_id;
    }
    $wpdb->query("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES ('$blogroll_id', '$cat_name', '$cat_slug', '0')");
    $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$blogroll_id', 'link_category', '', '0', '2')");

    update_option('default_link_category', $blogroll_id);'

  2. theapparatus
    Member
    Posted 14 years ago #

    What exactly are you asking here? Are you asking how to chenge them? Is it not working for you when you do change what is there?

  3. mvkozyrev
    Member
    Posted 14 years ago #

    Ok. I'm asking how to chenge them. When I try to duplicate code with new names of page and category it doesn't work :(

About this Topic

  • Started 14 years ago by mvkozyrev
  • Latest reply from mvkozyrev