problem multisite with blog id
At first glance, you’re assigning values to get_current_blog_id instead of comparing them. That is get_current_blog_id() = 1 should be get_current_blog_id() === 1 in both places.
At first glance, you’re assigning values to get_current_blog_id instead of comparing them. That is get_current_blog_id() = 1 should be get_current_blog_id() === 1 in both places.
I have write : <?php $blog_id = get_current_blog_id(); ?> <?php if( 1 == $blog_id ); ?> <div id=””><script src=””></script><script src=”” ></script></div> <?php elseif( 2 == $blog_id ): ?> <div id=””><script src=””></script><script src=”” ></script></div> <?php else: ?> Default script <?php endif; ?> It correct !?
$time = get_blog_details($blog_ID)->registered; $unix_time = strtotime($time); $my_time_format = date(‘Y-m-d H:i:s’, $time); // eg. 2011-09-28 00:20:34 $diff_format = human_time_diff($time); // eg. 2 days See date() and replace Y-m-d H:i:s with the format you want
[*] Each site in a Multisite network is considered to be exactly that — a separate site. All the $wpdb values (eg, $wpdb->posts) are distinct for each site. You can use switch_to_blog() and restore_current_blog() to get content (posts, etc) from the various sites[*] in your network: $sites = array( 1, 2, 3, ); $all_posts = … Read more
You need to use the global $current_blog instead. $GLOBALS[‘current_blog’]->blog_id will return the correct id.
Use switch_to_blog() http://codex.wordpress.org/WPMU_Functions/switch_to_blog, do the query and then restore back using restore_current_blog()
Make a list of sites for each user in WPMU – switch_to_blog (display in SITE_ID: 1)
Try this: global $current_blog; $blog = get_blog_details($current_blog->blog_id);
Here’s a quick way you could do it, though there are quite likely easier/better ways to do it. This is just what I can think of at the moment. Add a quick function to functions.php that will store the blog ID in the post meta. Then when you need to check where the post came … Read more
I know this is old, but this is the best way. Might help people coming here in the future. $get_users = get_users( array( ‘blog_id’ => get_current_blog_id() ) ); $user_id = $get_users[0]->ID;