Global Parent theme for all sites

Create a separate directory and a (sub) domain for your themes. Lets say the domain is themes.example.com, and the directory is /extra/wp-themes/. Now let all your installations use the new theme root. Or just do the same for plugins to manage all plugins from one place too. Registering a new theme root is not possible … Read more

when using add_user_to_blog getting error “Call to undefined function get_userdata”

get_userdata() is a pluggable function, you can find its declaration in wp-includes/pluggable.php. That means, plugins can declare it earlier, and it is not declared, when a plugin is loaded. When you look at wp-settings.php, you can see the load order: // Load active plugins. foreach ( wp_get_active_and_valid_plugins() as $plugin ) include_once( $plugin ); unset( $plugin … Read more

Sort posts from multiple sites by date

You could just usort the array before iterating. $allBlogPosts = get_posts( array( ‘posts_per_page’ => -1, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’ )); usort($allBlogPosts, ‘sortPosts’); function sortPosts($a, $b){ return strtotime($a->post_date) – strtotime($b->post_date); } //Your display loop… FYI, if you’re using PHP>=5.3, you can use a closure, which I personally think is cleaner for this type of … Read more

Multisite, sharing content by URL

Hope I understand you correctly. Not sure if your /Widgets content would be actual widgets, or just posts/pages, but I’ve been using this plugin for duplicating content between sites on a multisite network: http://wordpress.org/extend/plugins/diamond-multisite-widgets/ Use the “Broadcast on the network” feature. You can select on which sites you’d like to duplicate the content. 2 caveats: … Read more

What are the differences in capabilities between the super-administrator and administrator?

The super_admin has access to all admininstrator APIs and also the multi-site functions. If you go to the codex page, it will say so: http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table You can find the multisite functions here: http://codex.wordpress.org/Function_Reference#Multisite_functions If you want to do a more fine-grain investigation of what it can call, I suggest you get familiar with the WP … Read more

WPMU: Programmatically adding CPT posts to specific blog id

I finally found the answer myself. It’s two parts: I need the global $switched to be defined. The variable for blog id can’t be $blog_id because that’s reserved. The above code should thus be the following. require_once( “../wp-load.php” ); global $switched; $blog_id_target = 2; switch_to_blog($blog_id_target); $lang = ‘en’; $new_pr = wp_insert_post( array( ‘post_author’ => 1, … Read more

Tax_query not working on multisite

I found out that in order to query wp posts via custom taxonomy, from a blog 1 to another blog 2, you have to register that custom taxonomy in both blogs, otherwhise it won’t work. this is strange but true! anyways it works fine now.