Oxygen Theme – Badge not showing in shop page or categories page
-
In Oxygen Theme https://themeforest.net/item/oxygen-woocommerce-wordpress-theme/7851484 badges not showing in shop page or categories page.
https://www.ads-software.com/plugins/yith-woocommerce-badges-management/
-
I have the same problem, any solution please?
Mee too.
Hi,
You don’t see any badges in shop or category pages because your theme don’t use the standard WordPress hooks and functions.
To fix this issue you should replace the line 155 of wp-content/themes/oxygen/woocommerce/content-product.php:echo wp_get_attachment_image( $thumb_id, $thumb_size );
with the following code:
echo apply_filters('post_thumbnail_html', wp_get_attachment_image( $thumb_id, $thumb_size ), $id, $thumb_id );
Best Regards
YIThemesHi,
thanks for your reply! although it wouldn’t work because the /woocommerce/content-product.php only have 74 lines and there is none that look like that. I have the last version (4.0)This is the wp-content/themes/oxygen/woocommerce/content-product.php:
<?php /** * The template for displaying product content within loops * * This template can be overridden by copying it to yourtheme/woocommerce/content-product.php. * * HOWEVER, on occasion WooCommerce will need to update template files and you * (the theme developer) will need to copy the new files to your theme to * maintain compatibility. We try to do this as little as possible, but it does * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * * @see https://docs.woothemes.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates * @version 2.6.1 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } global $product; // Ensure visibility if ( empty( $product ) || ! $product->is_visible() ) { return; } ?> <div <?php post_class( oxygen_woocommerce_get_loop_item_class() ); ?>> <?php /** * woocommerce_before_shop_loop_item hook. * * @hooked woocommerce_template_loop_product_link_open - 10 */ do_action( 'woocommerce_before_shop_loop_item' ); /** * woocommerce_before_shop_loop_item_title hook. * * @hooked woocommerce_show_product_loop_sale_flash - 10 * @hooked woocommerce_template_loop_product_thumbnail - 10 */ do_action( 'woocommerce_before_shop_loop_item_title' ); /** * woocommerce_shop_loop_item_title hook. * * @hooked woocommerce_template_loop_product_title - 10 */ do_action( 'woocommerce_shop_loop_item_title' ); /** * woocommerce_after_shop_loop_item_title hook. * * @hooked woocommerce_template_loop_rating - 5 * @hooked woocommerce_template_loop_price - 10 */ do_action( 'woocommerce_after_shop_loop_item_title' ); /** * woocommerce_after_shop_loop_item hook. * * @hooked woocommerce_template_loop_product_link_close - 5 * @hooked woocommerce_template_loop_add_to_cart - 10 */ do_action( 'woocommerce_after_shop_loop_item' ); ?> </div>
Hi,
To fix this issue with Oxygen 4.1 you should replace the line 746 of wp-content/themes/oxygen/inc/laborator_woocommerce.php:echo wp_get_attachment_image( $thumb_id, $thumb_size );
with the following code:
echo apply_filters('post_thumbnail_html', wp_get_attachment_image( $thumb_id, $thumb_size ), $post->ID, $thumb_id);
Best Regards
YIThemes- This reply was modified 8 years, 2 months ago by YITHEMES.
Hi,
I’m having the exact same problem – although it’s with Ronneby Theme https://rnbtheme.com.
The solution above isn’t working in my case, since I can’t find the following lines.
Maybe it’s in the product-thumbnails.php – that’s the closest I get, but I can’t figure out what exactly to replace and with what. Hope you can help:)
Thanks!Hi annehundborg,
To fix this issue with Ronneby Theme you should replace the line 323 of wp-content/themes/ronneby/inc/woocommerce.php
ob_get_clean();
with the following code:
echo apply_filters( 'post_thumbnail_html', ob_get_clean(), $post->ID );
Best Regards
YIThemesThanks for your reply. Unfortunately I don’t have a ob_get_clean(); in line 323 of wp-content/themes/ronneby/inc/woocommerce.php
I have ob_get_clean(); on the following lines though – always with either “return” or “echo” in front. Which line should I replace? And should I replace ALL? meaning both ob_get_clean(); and either “return” or “echo”?
111: return ob_get_clean();
136: return ob_get_clean();
151: return ob_get_clean();
173: return ob_get_clean();
246: return ob_get_clean();
356: echo ob_get_clean();Thank you for your time.
Hello,
Same issue – but I am using the Sequoia Food Theme. There isn’t any image / attachment reference in content-product.php in this theme but there is in product-thumbnail.php and it looks like this:
<?php /** * Single Product Thumbnails * * This template can be overridden by copying it to yourtheme/woocommerce/single-product/product-thumbnails.php. * * HOWEVER, on occasion WooCommerce will need to update template files and you * (the theme developer) will need to copy the new files to your theme to * maintain compatibility. We try to do this as little as possible, but it does * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * * @see https://docs.woocommerce.com/document/template-structure/ * @author WooThemes * @package WooCommerce/Templates * @version 2.6.3 */ if ( ! defined( 'ABSPATH' ) ) { exit; } global $post, $product, $woocommerce, $of_sequoia; $of_img_format = $of_sequoia['single_product_image_format']; if( $of_img_format == 'plugin' ) { $img_format = 'shop_single'; }else{ $img_format = $of_img_format; } $magnifier = false; if( $of_sequoia['single_product_images'] == 'magnifier' ) { $magnifier = true; }; $attachment_ids = $product->get_gallery_attachment_ids(); $gall_id = ''; if ( $magnifier && $attachment_ids ) { $attachment_ids[] = get_post_thumbnail_id( $post->ID ); $gall_id = ' id="gallery-'.$post->ID.'"'; } if ( $attachment_ids ) { $loop = 0; $columns = apply_filters( 'woocommerce_product_thumbnails_columns', 3 ); ?> <div class="thumbnails"<?php echo $gall_id; ?>> <?php foreach ( $attachment_ids as $attachment_id ) { $classes = array( 'zoom' ); if ( $loop == 0 || $loop % $columns == 0 ) $classes[] = 'first'; if ( ( $loop + 1 ) % $columns == 0 ) $classes[] = 'last'; $image_link_src = wp_get_attachment_image_src( $attachment_id, $img_format ); $image_link = $image_link_src[0]; if ( ! $image_link ) continue; $image_class = esc_attr( implode( ' ', $classes ) ); $image_title = esc_attr( get_the_title( ) ); $image = wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_large_thumbnail_size', 'thumbnail' ), array( 'title' => $image_title )); $full_image_src = wp_get_attachment_image_src( $attachment_id, 'full' ); $full_image = $full_image_src[0]; $product_title = esc_attr( get_the_title() ); $product_link = esc_attr( get_permalink() ); // CONDITIONAL VARS FOR IMAGE AND LARGE IMAGE LINK: $href = $magnifier ? '#' : $full_image; $a_attrs = $magnifier ? 'class="button tiny" data-image="'.$image_link.'" data-zoom-image="'.$image_link.'" data-full-image="'.$full_image .'"' : 'class="button tiny magnificpopup mfp-image"'; $icon = $magnifier ? 'icon icon-arrow-up-7' : 'icon icon-zoom-in'; echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( ' <div class="item %2$s"> <div class="item-content" style="border:2px solid #ff00cc;"> <div class="item-img"> <div class="front">%4$s</div> <div class="back"> <div class="item-overlay"></div><!-- item-overlay --> <div class="back-buttons"> <a href="'.$href.'" title="%3$s" '. $a_attrs .'> <div class="'.$icon.'" aria-hidden="true"></div> </a> </div> </div><!-- back --> </div><!-- item-img --> </div><!-- item-content --> </div><!-- item -->', $image_link, // 1 $image_class, // 2 $image_title, // 3 $image, // 4 $full_image, // 5 $product_title // 6 ), $attachment_id, $post->ID, $image_class ); $loop++; } ?></div> <script type="text/javascript"> jQuery(document).ready( function($) { var aButton = $('.thumbnails').find('a.button'), target = $('.images').find('a.larger-image-link'); aButton.on('mousedown' ,function () { var _this = $(this), img_Link = _this.data('full-image'); target.attr('href', img_Link); }); }); // end doc ready </script> <?php }
- The topic ‘Oxygen Theme – Badge not showing in shop page or categories page’ is closed to new replies.