钩入wpmu_new_blog
并创建页面:
add_action(\'wpmu_new_blog\', \'create_my_pages\', 10, 2);
function create_my_pages($blog_id, $user_id){
switch_to_blog($blog_id);
// not really need, new blogs shouldn\'t have any content
if(get_page_by_title(\'About this Network\')) return;
// create each page
$page_id = wp_insert_post(array(
\'post_title\' => \'About this Network\',
\'post_name\' => \'about-this-network\',
\'post_content\' => \'Co za asy...\',
\'post_status\' => \'publish\',
\'post_author\' => $user_id, // or "1" (super-admin?)
\'post_type\' => \'page\',
\'menu_order\' => 666,
\'comment_status\' => \'closed\',
\'ping_status\' => \'closed\',
// + see: http://codex.wordpress.org/Function_Reference/wp_insert_post
));
restore_current_blog();
}
你可以把它放在你网络激活的插件中,或者放在必须使用的插件中,这样它们在所有主题中都可用。
另一种方法是使用template_redirect
钩住并包含您自己的模板文件