• Resolved do77

    (@do77)


    I have WPMU installed (I know its not the wpmu forum but someone might still know) and I would like to add a second default page to each blog that is created. Let’s say when you register a blog you automatically have the page ‘About’ and then also ‘Example’.

    How can I achieve that? I know I have to edit the wpmu-functions.php file but what do I have to do?

    Thanks!! I appreciate any hints!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Don’t know how MU does it but in the wp-content folder, define a file called install.php, and in that put a wp_install_default function. Since a default category of some kind is assumed, it’s a good idea to create a least one category (code example derived from /wp-admin/includes/upgrade.php):

    <?php
      function wp_install_defaults() {
        global $wpdb;
        // Default category
        $cat_name = $wpdb->escape(__('Uncategorized'));
        $cat_slug = sanitize_title(_c('Uncategorized|Default category slug'));
        $wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')");
        $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('1', 'category', '', '0', '1')");
        }
    ?>

    You would need to add your code to create your pages there–see wp-admin/includes/upgrade.php for the example of the About page.

    Thread Starter do77

    (@do77)

    Thanks for your response MichaelH!

    I was wondering if I could add another page by simply editing the file wpmu-funtions.php? Here is an extract of the file:

    // First page
    	$wpdb->insert( $wpdb->posts, array(
    		'post_author' => $user_id,
    		'post_date' => $now,
    		'post_date_gmt' => $now_gmt,
    		'post_content' => get_site_option( 'first_page' ),
    		'post_excerpt' => '',
    		'post_title' => __('About'),
    		'post_name' => __('about'),
    		'post_modified' => $now,
    		'post_modified_gmt' => $now_gmt,
    		'post_status' => 'publish',
    		'post_type' => 'page',
    		'to_ping' => '',
    		'pinged' => '',
    		'post_content_filtered' => ''
    	) );
    
    	// Flush rules to pick up the new page.
    	$wp_rewrite->init();
    	$wp_rewrite->flush_rules();

    Wouldn’t it be possible to just add another page, “//Second Page” for example!?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Add a second default page’ is closed to new replies.