Single product page header image

Hi,
I am trying to add a header image to my single product pages. It doesn’t work in Cornerstone as there seems to be a conflict with another plugin.

I get the below error:

So then I followed the suggestion in this support topic https://theme.co/apex/forum/t/how-can-i-put-a-header-image-on-a-single-product-page/36346. I added the global block with a background image and headline. I also added the below code to my child theme’s functions.php file.

add_option( 'x_after_view_global__slider-below', 'print_product_image' );
function print_product_image(){
	if(is_singular( 'product' )){
		echo do_shortcode( '[my-shortcode]' );
	}
}

It didn’t do anything because I’m assuming that it’s looking to place the shortcode after the slider. As I am not using a slider, what do I change this code to so that the global block sits under the masthead (navigation bar) and above the content?

Thanks!

Hello @9metis,

Thanks for writing in!

Have you created your global block already? If that is the case, simply update the code and use this:

add_option( 'x_after_view_global__slider-below', 'print_product_image' );
function print_product_image(){
	if(is_singular( 'product' )){
		echo do_shortcode( '[cs_gb id=123]' );
	}
} 

Make sure that [cs_gb id=123] has been replaced with the correct shortcode of your global block.

Please let us know how it goes.

Thanks but I did add that code in with my shortcode but it doesn’t work.

Hey @9metis,

add_option is used in the code. It should be add_action. You can learn more about our themes’ action hooks at https://theme.co/apex/forum/t/customizations-actions-and-filters-in-x/208

Your Global Block now displays in the single product page.

Hope that helps.

Perfect, thanks!

You’re welcome!
We’re glad @Christian were able to figure out to resolve the issue.

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