Changeset 2671408
- Timestamp:
- 02/02/2022 03:17:46 PM (4 years ago)
- File:
-
- 1 edited
-
socialproofy/trunk/socialproofy.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
socialproofy/trunk/socialproofy.php
r2671404 r2671408 66 66 } 67 67 68 $ args =array(68 $products_query = get_posts(array( 69 69 'post_type' => 'product', 70 'posts_per_page' => $product_count, 71 'offset' => $offset, 72 ); 73 $loop = new WP_Query($args); 74 if ($loop->have_posts()) { 75 while ($loop->have_posts()) { 76 $loop->the_post(); 77 $items = socialproofy_prepare_product_array(get_the_ID()); 78 foreach ($items as $item) { 79 $products[] = $item; 80 } 81 } 70 'numberposts' => $product_count, 71 'offset' => $offset 72 )); 73 74 foreach ($products_query as $item) { 75 $products[] = socialproofy_prepare_product_array($item->ID); 82 76 } 83 77 … … 297 291 298 292 $product = wc_get_product($product_id); 299 300 $images_arr = wp_get_attachment_image_src($product->get_image_id(), array('72', '72'), false);301 293 $image = null; 294 $permalink = null; 295 296 if ($product) { 297 $permalink = $product->get_permalink(); 298 $images_arr = wp_get_attachment_image_src($product->get_image_id(), array('72', '72'), false); 299 $price = $product->get_price(); 300 } 301 302 302 if ($images_arr !== null && $images_arr[0] !== null) { 303 303 $image = $images_arr[0]; … … 306 306 } 307 307 } 308 309 $permalink = $product->get_permalink();310 $price = $product->get_price();311 308 312 309 if ($product->is_type('variable')) {
Note: See TracChangeset
for help on using the changeset viewer.