Woo Footer from Section

Hi There,

I have the code for functions.php to insert html at the bottom of the Woo Single Product page.

Is there any way I can paste or insert the code from an existing Cornerstone section I have? Basically, I have a footer that I use on pages, and I’d love to be able to paste this underneath the products.

Thanks in advance.

Hey @el3ctrofuzz,

Just to clarify, do you wish to insert a Cornerstone created content to your function? If so, recreate the section using the Global Blocks and output the global block shortcode in your function using the do_shortcode function.

If you wish to insert HTML to a Cornerstone built page, use the Raw Content element.

Hope that helps.

1 Like

Hey Christian,

Global Blocks is the answer! Thank you! I didn’t realise there was a built in shortcode feature to it.

Wonderful :slight_smile:

Hey Christian,

I have added the shortcode to my functions.php using the following code:

add_action( 'woocommerce_after_single_product' , 'product_global_footer', 15 );

function product_global_footer() {
echo '[cs_gb id=3502]';
}

but the shortcode is not picked up by the theme. The output simply displays the text “[cs_gb id=3502]” on my product page.

Any ideas why the shortcode is not working?

PS Shortcodes work if I edit them into the product descriptions, but not after the product as I am trying to do.

Happy New Year Christian!

After a brain wave in the night, I realised that I was probably calling the shortcode incorrectly. I did a bit more research and found the “do_shortcode” bit. for anyone looking for the answer, the code above should have read:

//=== add footer to product pages ===//

add_action( 'woocommerce_after_single_product' , 'product_global_footer', 15 );
 
function product_global_footer() {
   echo do_shortcode( '[cs_gb id=3502]');
}

Thanks again for your initial help :slight_smile:

Hey @el3ctrofuzz,

We are just glad that you have figured it out a way to correct the said issue.
Thanks for letting us know!

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.