add_action( 'init', 'wc_readd_add_to_cart_buttons' );
function wc_readd_add_to_cart_buttons() {
//add to cart button loop
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
}
I am adding back a button in WooCommerceand need to have a <br>
before the button. How do I insert a <b>
inside the above action?
2 Answers
You can use ‘echo’ (or ‘print’) to enclose HTML, but sometimes that gets a bit messy with complex HTML, not to mention having to escape quote/double-quote character.
So try something like this:
function myfunction() {
// after this next, plain HTML
?>
<div class="myclass"><h1 align="center">This is a heading</h1></div>
<!-- more HTML code here -->
<?php // back to PHP
// .. some more PHP stuff
return;
}
That allows you to put in some complex HTML (or a bunch of it) without having to use echo/print
.