im sure i must be doing something wrong and would really appreciate a little help.
I am trying to loop through all of my Sub Dir "Multisite" blogs using switch_to_blog, below:
global $wpdb, $blog_id, $post;
$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM wp_blogs ORDER BY blog_id" ) );
foreach ($blogs as $blog){
switch_to_blog($blog->blog_id);
$globalquery = get_posts('numberposts=5&post_type=any');
restore_current_blog();
}
array_merge($globalquery, $portfolio);
It does work (kinda), it moves to the next blog (id = 2) and is retrieving posts, but goes no further and does not retrieve the main blog posts (id = 1).
I am a self proclaimed php noob, but really enjoy learning and i think im doing quite well lol
Please if someone could help me out?
Regards Rory
UPDATE I am trying to create a loop that i can pass into an already declared query:
// create query the portfolio (pass it to $wp_query)
$portfolio_query = new WP_Query( $portfolio );