網頁

2013年10月16日 星期三

WordPress MU WordPress 3.0


 
$post_email = $_POST['email'];//='htshboy@gmail.com';
echo $post_email.':';

require( '../../wp-load.php' ); //API串接呼叫WP函式 請請求wp-load.php
/** Load WordPress Administration Bootstrap */
//require_once( './admin.php' ); //這會導出界面



 $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id );

 // assign template and stylesheet to the blog
 update_blog_option( $id, 'template', 'twentytwelve' );
 update_blog_option( $id, 'stylesheet', 'twentytwelve');

WordPress network: set themes and plugins for new blog

You can use the following code to assign template and stylesheet to a sub site/blog:
// create the blog
$blog_ID = wpmu_create_blog( $domain, $path, $title, 1 );

// assign template and stylesheet to the blog
update_blog_option( $blog_ID, 'template', 'your_template_name' );
update_blog_option( $blog_ID, 'stylesheet', 'your_stylesheet_name' );
This will assign the template and stylesheet to the blog that has been just created. Please visit the following link to see the documentation for wpmu_create_blog function.
wpmu_create_blog



發文到主站與各自網站

WordPress Multisite - Questions about select all posts from all network sites


WP_INSERT_POST issue on Wordpress Multisite


Changing site in WordPress Multisite (e.g. for getting posts from other sites)



 

        $otherBlogID = 2;
        switch_to_blog( $blog_id );

 $the_post_id = wp_insert_post( $my_post );
 //WP_INSERT_POST issue on Wordpress Multisite
 switch_to_blog( $otherBlogID ); //Switch to the other blog
 $otherPostID = wp_insert_post($my_post, false); //Insert post into other blog
        restore_current_blog(); //Switch back to the current blog

wp_registration_log 資料表會累積建站資訊 wp_site wp_users

沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。