Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global $post;
- while ( $results->have_posts() ) {
- $results->the_post();
- if ( isset ( $post->blog_id ) )
- switch_to_blog( $post->blog_id );
- if ( $post_type == 'product' && woodmart_woocommerce_installed() ) {
- $product = $factory->get_product( get_the_ID() );
- $suggestions[] = array(
- 'value' => html_entity_decode( get_the_title() ),
- 'permalink' => get_the_permalink(),
- 'price' => $product->get_price_html(),
- 'thumbnail' => $product->get_image(),
- 'sku' => $product->get_sku() ? esc_html__( 'SKU:', 'woodmart' ) . ' ' . $product->get_sku() : '',
- );
- } else {
- $suggestions[] = array(
- 'value' => html_entity_decode( get_the_title() ),
- 'permalink' => get_the_permalink(),
- 'thumbnail' => get_the_post_thumbnail( null, 'medium', '' ),
- );
- }
- if ( isset ( $post->blog_id ) )
- restore_current_blog( $post->blog_id );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement