- This topic has 7 replies, 2 voices, and was last updated 4 years, 4 months ago by
Tom.
-
AuthorPosts
-
January 7, 2019 at 8:15 am #775396
Shield one,
January 7, 2019 at 3:52 pm #775730Tom
Lead DeveloperLead DeveloperHi there,
Those elements are added using these hooks:
add_action( 'woocommerce_before_shop_loop_item_title' , 'generatepress_wc_image_wrapper_open', 8 ); add_action( 'woocommerce_shop_loop_item_title' , 'generatepress_wc_image_wrapper_close', 8 );
So make sure these hooks exist in your template:
woocommerce_before_shop_loop_item_title woocommerce_shop_loop_item_title
January 8, 2019 at 12:02 pm #776594Shield one,
I think that this should be part of template which i am calling – product content?
But i did not changed this template so default one should be called. So same as when i show shop page. And in shop page it is ( this html wrapper).I saw this actions which you sended. But i don’t understand, why it is not applied also when i am calling this template.
January 8, 2019 at 5:13 pm #776729Tom
Lead DeveloperLead DeveloperYes, it should be: https://github.com/woocommerce/woocommerce/blob/d0491072e8a7d0a4535db0ec2bae4a6d43ff64fd/templates/content-product.php#L42
Just to confirm, is the archive image option checked in Customize > Layout > WooCommerce?
January 9, 2019 at 4:37 am #777005Shield one,
Sure, it’s setted.
As I say, on most of the places it is showing properly. But in Category Page, I have custom filtering which will load produts through ajax. And on the server side there is called product content template part. So I think, that different template is loaded. Or your hooks are not applied.
So now i tried to make small test. I added some custom text to this content product template. And it is showing properly in both version (also in category page – where is also img wrapper included, and also after filtering with ajax). So same template is loaded, only hooks are not applied when i am calling template from php through ajax. (maybe ajax is problem?)
January 9, 2019 at 8:39 am #777392Tom
Lead DeveloperLead DeveloperThat could be the issue. You might need to manually add the HTML elements into the product template.
For example, this would be under the
woocommerce_before_shop_loop_item_title
hook:echo '<div class="wc-product-image"><div class="inside-wc-product-image">';
And this would go under the
woocommerce_shop_loop_item_title
hook:echo '</div></div>';
Of course, this means you’ll want to pay attention to updates in case we change something that affects the markup.
January 11, 2019 at 5:01 am #779059Shield one,
This solved my problem:
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_remove_thump_wrapper', 1); if ( ! function_exists( 'woocommerce_remove_thump_wrapper' ) ) { function woocommerce_remove_thump_wrapper() { remove_action( 'woocommerce_before_shop_loop_item_title' , 'generatepress_wc_image_wrapper_open', 8 ); remove_action( 'woocommerce_shop_loop_item_title' , 'generatepress_wc_image_wrapper_close', 8 ); remove_action( 'woocommerce_before_subcategory_title' , 'generatepress_wc_image_wrapper_open', 8 ); remove_action( 'woocommerce_before_subcategory_title' , 'generatepress_wc_image_wrapper_close', 20 ); add_action( 'woocommerce_before_shop_loop_item_title' , 'generatepress_wc_image_wrapper_open', 8 ); add_action( 'woocommerce_shop_loop_item_title' , 'generatepress_wc_image_wrapper_close', 8 ); add_action( 'woocommerce_before_subcategory_title' , 'generatepress_wc_image_wrapper_open', 8 ); add_action( 'woocommerce_before_subcategory_title' , 'generatepress_wc_image_wrapper_close', 20 ); } }
January 11, 2019 at 8:39 am #779324Tom
Lead DeveloperLead DeveloperGlad you found a solution!
-
AuthorPosts
- You must be logged in to reply to this topic.