Switch to Blog and WP_Query Example
<?php
function smcm_pull_faculty_from_directory() {
//Get the slug of the calling site... array element [3]
$site_slug = explode ("/", get_site_url());
// blog id of the directory
$blog_id = 7;
switch_to_blog( $blog_id );
$args = array(
'post_type' => 'faculty_profile',
'tax_query' => array(
array(
'taxonomy' => 'dept_prog_tag',
'field' => 'slug',
'terms' => $site_slug[3]
)
)
);
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
the_post_thumbnail(array(100,100));
echo '<p><a class="people-button" href="' . $permalink = get_permalink() . '">View Profile</a></p>';
}
} else {
// no posts found
}
/* Restore original Post Data */
wp_reset_postdata();
restore_current_blog();
}