Matt Bernhardt
Forum Replies Created
-
If I understand the linked bug report correctly, this is a known issue with the switch_to_blog() function, which might be fixed in the 3.9 release? I think? I’m not well versed in the internals of WordPress so I may be missing something.
At any rate, I’ve managed to get the code block working now by abandoning the_post_thumbnail() in favor of a custom-rewritten image tag. Here’s the code:
<?php // switch to news blog switch_to_blog(7); $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 5, 'orderby' => 'post_date', 'order' => 'DESC', 'tag' => 'foobar' ); $the_slides = null; $the_slides = new WP_Query($args); if( $the_slides->have_posts() ) { while ( $the_slides->have_posts() ) : $the_slides->the_post(); setup_postdata($post); $image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'thumbnail'); $imageURL = str_replace('/foobar/wp-content/uploads/','/news/files/',$image[0]); $imageTag = '<img src="'.$imageURL.'" alt="" height="'.$image[2].'" width="'.$image[1].'">'; ?> <p> <a href="<?php the_permalink(); ?>"> <?php echo $imageTag; ?><br> <?php the_title(); ?> </a><br> <?php the_time('F jS, Y'); ?><br> </p> <?php endwhile; } // switch back to Foobar site restore_current_blog(); ?>Hopefully this helps save someone else some trouble.