The MU forums have moved to WordPress.org

How to set each new blog with a page up front? (2 posts)

  1. Farms2
    Member
    Posted 17 years ago #

    Here's one for you uber techs... am playing with each new blog (including the site admin blog) being set up with a default page as the front end rather than latest posts.

    I'm semi-au fait with the code for creating a new page (this I think) from wpmu-functions.php:

    // 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 the text I want to go on the front page'))."', '', '".$wpdb->escape(__('Front'))."', '0', '".$wpdb->escape(__('front'))."', '$now', '$now_gmt', 'publish', 'page', '', '', '')");
    $wpdb->query( "INSERT INTO $wpdb->post2cat (
    rel_id, post_id, category_id) VALUES (2, 2, 1)" );
    // Flush rules to pick up the new page.
    $wp_rewrite->init();
    $wp_rewrite->flush_rules();

    But I'm at a total loss of how to set the "show_on_front" options (from options-reading.php line 38) to 'on' - and to have it select this page as the one I want up front (rather than 'about' for example) so that this page will appear as the first page in a new install as well as on each new blog...

    (With the new install I figure the code needs to be in index-install.php as well as in wpmu-functions.php)

    Any ideas? Help hugely appreciated!

    Cheers, James

  2. Farms2
    Member
    Posted 17 years ago #

    $wpdb->query( "INSERT INTO $wpdb->options (show_on_front) VALUES (page)" );

    doesn't work... sorry for being such an ignoramus!

About this Topic