Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I created a multisite and my question is as followed:

Im trying to display a default static page for each new site. So when they create a new site, they automatically get a default page I made. This is the only page they need and have controle over. This page has only widgetized area's in it so that the site-admin can add content by adding widgets into the widget area's. They dont have access to create a post or page themselves.

By adding a piece of code into wp-admin/includes/upgrade.php the page will be automatically made by WP whenever a new site is made. However, the page isnt connected to the template with the html/php code in it to display the widgets they add. Normally in WP you can create a page and on the right side you can select a template.

Is it clear this far? (even I get confused lol)

So what Im asking is.. is there a way to create a static frontpage for all newly created sites (like test.example.com and test2.example.com) with a template connected to it?

Thanks in advance!!! It would make my day!

share|improve this question

2 Answers 2

I would recommend waiting until WordPress 3.4 is released. Among other features, it is slated to include the ability to allow Themes to define/declare a static front page. I believe this functionality should suit your needs.

(Note: as of today, WordPress 3.4 just hit Beta 1, and is scheduled for final release in May.)

share|improve this answer

You can hook into the creation of a new multisite blog like this:

add_action('wpmu_new_blog', 'default_settings', 100, 2);
function default_settings($blog_id, $user_id){
    switch_to_blog($blog_id);

    // setup your page here

    restore_current_blog();
}

In that function you would use wp_insert_post to create your page, and then you would set the option used to determine the homepage to the ID of the newly created post

share|improve this answer
    
Somthing like: $pages_to_create = array_diff($default_pages,$temp); foreach($pages_to_create as $new_page_title){ // Create post object $my_post = array(); $my_post['post_title'] = $new_page_title; $my_post['post_content'] = 'This is my '.$new_page_title.' page.'; $my_post['post_status'] = 'publish'; $my_post['post_type'] = 'page'; ?? –  Furzery Apr 4 '12 at 9:34
    
yeah, though with the insertion call and the closing of the loop etc –  Tom J Nowell Apr 4 '12 at 9:51
    
Note that you could also use a home.php template –  Tom J Nowell Apr 4 '12 at 9:51
    
how would that work? (the home.php) I know how to create a custom template-page but I guess thats not what you meanth –  Furzery Apr 4 '12 at 11:17
    
refer to the template heirarchy, you have index.php front-page.php and home.php home.php is always the homepage unless you choose a page to be the homepage, front-page.php is the frontpage, aka page 1 of an archive shown by index.php, and index.php is the file used if a file isn't found –  Tom J Nowell Apr 4 '12 at 13:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.