Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1417070
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI'm building a function to interact with the price html block in wordpress. This is my code
add_filter( 'woocommerce_get_price_html', array( $this, 'get_price_html' ));
public function get_price_html( $product )
{
echo '<a href="my-price">' . $product->get_price() . '</a>';
}
It's not working. What's wrong?
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI'm building a function to interact with the price html block in wordpress. This is my code
add_filter( 'woocommerce_get_price_html', array( $this, 'get_price_html' ));
public function get_price_html( $product )
{
echo '<a href="my-price">' . $product->get_price() . '</a>';
}
It's not working. What's wrong?
Share Improve this question edited Aug 8, 2019 at 15:58 edeb asked Aug 8, 2019 at 15:46 edebedeb 131 silver badge5 bronze badges 2- there is no actual question here – Jon Commented Aug 8, 2019 at 15:57
- 1 sorry I forgot it :D but I placed it in the title – edeb Commented Aug 8, 2019 at 15:58
1 Answer
Reset to default 0I think your are missing parameters (even if you're not using those) as per its definition and always try to return
into filters instead of echo
the value. Try the following:
add_filter( 'woocommerce_get_price_html', array( $this, 'get_price_html' ), 10, 2);
public function get_price_html( $price_html, $product )
{
return '<a href="my-price">' . $product->get_price() . '</a>';
}
本文标签: plugin developmentCan39t get woocommercegetpricehtml to work
版权声明:本文标题:plugin development - Can't get woocommerce_get_price_html to work 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745257720a2650200.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论