php - When changing woocommerce title hook the first item doesn't change -


i have strange behaviour don't understand

i've changed woocommerce_shop_loop_item_title hook add link title of product. code inside functions.php

// add href title function abchangeproductstitlehook(){     remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );     add_action('woocommerce_shop_loop_item_title', 'abchangeproductstitle', 10 ); } add_action( 'woocommerce_shop_loop_item_title', 'abchangeproductstitlehook' ); function abchangeproductstitle() {     echo '<h2 class="woocommerce-loop-product_title"><a href="'.get_the_permalink().'">' . get_the_title() . '</a></h2>'; } 

it works on products except first one.

i've made similar change hook change thumbnail image background image , 1 doesn't work on first product. it's first product if change order of products.

below see screenshot of the first row of products on page , first 1 displayed differently

first product different

it helpful if knows problem or can point me in right direction .

thank alex

the way removing , adding woocommerce_shop_loop_item_title problem. try way.

remove_action( 'woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title', 10 ); add_action('woocommerce_shop_loop_item_title', 'abchangeproductstitle', 10 ); function abchangeproductstitle() {     echo '<h2 class="woocommerce-loop-product_title"><a href="'.get_the_permalink().'">' . get_the_title() . '</a></h2>'; } 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -