Title: content-product.php … post thumbnail hook
Last modified: August 31, 2016

---

# content-product.php … post thumbnail hook

 *  Resolved [adsim](https://wordpress.org/support/users/adsim/)
 * (@adsim)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/content-productphp-post-thumbnail-hook/)
 * I try to set the post thumbnail in the content-product.php apart from headline
   and other text in the product grid and group all text there in a div.
    This works
   great in the “normal” shop loop, but not at related products or my custom product
   loop on the homepage.
 * It seems the “normal” shop loop uses the **woocommerce_before_shop_loop_item**
   hook to output the thumbnail and in the other cases the **woocommerce_before_shop_loop_item_title**
   hook ist used and **woocommerce_before_shop_loop_item** outputs nothing.
 * Is there any way to change this or to work around this?
    I tried to move the **
   woocommerce_before_shop_loop_item_title** outside the headline anchor, but if
   I do so the post thumbnail misses a link around it.
 * Links: [1. normal shop loop](https://www.testboks.com/tausendsassa/shop/)
    [2. related products loop](https://www.testboks.com/tausendsassa/produkt/dicker-elefant-mit-ohne-hose/)
 * P.S. Maybe I should add the following: archive-product.php and related.php both
   use content-product.php to display one product in a product grid, but different
   hooks (and so the thumbnail is placed at different places) are used to include
   the post thumbnail.
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/content-productphp-post-thumbnail-hook/#post-6983993)
 * Both loops by default use the same template. content-product.php.
 * [https://github.com/woothemes/woocommerce/blob/8f26233905ea6fbde6c5af83abbd699e98b4d322/templates/single-product/related.php#L56](https://github.com/woothemes/woocommerce/blob/8f26233905ea6fbde6c5af83abbd699e98b4d322/templates/single-product/related.php#L56)
 *  Thread Starter [adsim](https://wordpress.org/support/users/adsim/)
 * (@adsim)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/content-productphp-post-thumbnail-hook/#post-6984030)
 * Yes, I know. But both loops use INSIDE of content-product.php different hooks
   to output the product thumbnail.
    I don’t know why. If archive-products.php uses
   content-product.php the **woocommerce_before_shop_loop_item** hook is used and
   if related.php uses the content-product.php the **woocommerce_before_shop_loop_item_title**
   hook is used. And so the output is different (**woocommerce_before_shop_loop_item**
   wraps an extra anchor around the thumbnail and places it BEFORE the other anchor
   with the headline, price and so on … that’s the output I want to have … **woocommerce_before_shop_loop_item_title**
   wraps no extra anchor around the thumbnail and places it INSIDE the anchor with
   the headline, price and so on).
 * And my question is if there is a way to change this behaviour.
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/content-productphp-post-thumbnail-hook/#post-6984031)
 * If the same template is used, the same hooks are used. The template contains 
   both hooks.
 * [https://github.com/woothemes/woocommerce/blob/8f26233905ea6fbde6c5af83abbd699e98b4d322/templates/content-product.php#L59-L67](https://github.com/woothemes/woocommerce/blob/8f26233905ea6fbde6c5af83abbd699e98b4d322/templates/content-product.php#L59-L67)
 *  Thread Starter [adsim](https://wordpress.org/support/users/adsim/)
 * (@adsim)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/content-productphp-post-thumbnail-hook/#post-6984032)
 * I know that the template contains both hooks, but only one hook outputs the thumbnail(
   and which one depends on which loop is used … see my writing above)
    Hm. So you
   mean that’s not how it should be?
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/content-productphp-post-thumbnail-hook/#post-6984033)
 * The thumbnail is hooked into the item_title hook here: [https://github.com/woothemes/woocommerce/blob/38df18884874a1093f829ce37e81f16f9f5c58d1/includes/wc-template-hooks.php#L97](https://github.com/woothemes/woocommerce/blob/38df18884874a1093f829ce37e81f16f9f5c58d1/includes/wc-template-hooks.php#L97)
 * Not the other one as far as I can see.
 *  Thread Starter [adsim](https://wordpress.org/support/users/adsim/)
 * (@adsim)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/content-productphp-post-thumbnail-hook/#post-6984038)
 * That’s strange.
    Hm. Ok. Thanks.
 * So I have to look if another plugin causes this weird behaviour.
    It’s not my
   theme, because the problem remains if I change to a default theme.
 *  Thread Starter [adsim](https://wordpress.org/support/users/adsim/)
 * (@adsim)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/content-productphp-post-thumbnail-hook/#post-6984042)
 * Ok, I caught the culprit.
    The Product Gallery Slider seems to change the hook.
   [https://www.woothemes.com/products/product-gallery-slider/](https://www.woothemes.com/products/product-gallery-slider/)
   If I deactivate it everything is “normal”, means the item_title hook is used.
 * Very strange.
 * Thanks for your help.
    Let’s see how I could use the strange behaviour. 😉

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘content-product.php … post thumbnail hook’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [adsim](https://wordpress.org/support/users/adsim/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/content-productphp-post-thumbnail-hook/#post-6984042)
 * Status: resolved