admin管理员组文章数量:1130349
remove_action('woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title',10);
add_action('woocommerce_shop_loop_item_title','fun',10);
function fun()
{
echo 'custom_field_value';
}
Note: I want to replace the title on shop page with custom field value. The code is correct but the echo part I need help on it.
remove_action('woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title',10);
add_action('woocommerce_shop_loop_item_title','fun',10);
function fun()
{
echo 'custom_field_value';
}
Note: I want to replace the title on shop page with custom field value. The code is correct but the echo part I need help on it.
Share Improve this question edited Dec 11, 2018 at 10:17 Pratik Patel 1,1091 gold badge11 silver badges23 bronze badges asked Dec 11, 2018 at 3:25 Joseph PausalJoseph Pausal 1 1- try this code :if (is_shop()){ echo 'custom_field_value'; } – vikrant zilpe Commented Dec 11, 2018 at 14:15
2 Answers
Reset to default 0woocommerce_shop_loop_item_title is not the right hook to change the title on shop page.
Try this instead:
add_filter( 'woocommerce_page_title', function() {
echo 'custom_field_value';
} );
I need help on this section only since the code I have provided is 100% working to remove the title.
echo 'custom_field_value';
If I will call custom field as custom_title how can I show this?
remove_action('woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title',10);
add_action('woocommerce_shop_loop_item_title','fun',10);
function fun()
{
echo 'custom_field_value';
}
Note: I want to replace the title on shop page with custom field value. The code is correct but the echo part I need help on it.
remove_action('woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title',10);
add_action('woocommerce_shop_loop_item_title','fun',10);
function fun()
{
echo 'custom_field_value';
}
Note: I want to replace the title on shop page with custom field value. The code is correct but the echo part I need help on it.
Share Improve this question edited Dec 11, 2018 at 10:17 Pratik Patel 1,1091 gold badge11 silver badges23 bronze badges asked Dec 11, 2018 at 3:25 Joseph PausalJoseph Pausal 1 1- try this code :if (is_shop()){ echo 'custom_field_value'; } – vikrant zilpe Commented Dec 11, 2018 at 14:15
2 Answers
Reset to default 0woocommerce_shop_loop_item_title is not the right hook to change the title on shop page.
Try this instead:
add_filter( 'woocommerce_page_title', function() {
echo 'custom_field_value';
} );
I need help on this section only since the code I have provided is 100% working to remove the title.
echo 'custom_field_value';
If I will call custom field as custom_title how can I show this?
本文标签: theme developmentHow to show Custom Field Value in Woocommerce Shop Page
版权声明:本文标题:theme development - How to show Custom Field Value in Woocommerce Shop Page 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749087870a2314059.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论