[Plugin: Taxonomy Images] display tax image when used with switch_to_blog
-
I use a simple little function below to display a taxonomy image on my custom post-type single.php page.
$terms = apply_filters( 'taxonomy-images-get-terms', '', array( 'taxonomy' => 'feature', ) ); if ( ! empty( $terms ) ) { print "\n" . '<div class="row">'; foreach( (array) $terms as $term ) { print "\n" . '<div class="four columns">'; print "\n\t" . '<a href="' . wp_get_attachment_url( $term->image_id ) . '" rel="lightbox unique-woo-feature">' . wp_get_attachment_image( $term->image_id, 'unique-woo-feature' ) . '</a>'; print "\n\t" . '<h5>' . esc_html( $term->name ) . '</h5>'; print "\n\t" . '<p>' . esc_html( $term->description ) . '</p>'; print "\n" . '</div>'; } print "\n" . '</div>'; }
This actually works perfect.
Where I get stuck:
On my network site, (another blog on the network), I am using the same code within a page only I am adding in
switch_to_blog() and of course restore_current_blog().When I do that, then the taxonomy images will not show up.
I am able to pull in the post title, content, etc, everything but the function above does not work.
This tells me that I have the switch to blog setup correctly, but I am missing something when it comes into pulling in custom taxonomy data.
Any help would be greatly appreciated, as google was no help. Seems not to many people out there using switch_to_blog, esp when combined with tax metadata.
thanks
https://www.ads-software.com/extend/plugins/taxonomy-images/
- The topic ‘[Plugin: Taxonomy Images] display tax image when used with switch_to_blog’ is closed to new replies.