Component Is Showing Code Above Footer After Making Changes to it

Hi, a few years ago when there were Global Blocks instead of Components for your theme, I created a global block to be positioned just above the footer to go on every page of a website. I got the script from yourselves to add into the functions.php to make this possible.

It’s been working fine up until today. I went into the component to make some changes to it and after doing that, on the front end it’s now displaying code instead of the content in the component. I don’t know if the script in the functions.php file needs to be updated to something different, as at the minute it refers to global block instead of component. I have no idea how to fix it! I hope you can help!

I’ve had to remove the script from the live site because it was showing code on the front end, but I’ve created a staging site with the script in the functions.php file so you can see the issue.

I’ll put the website details and login info in a secure note.

Thanks!

Hi @core365,

Thanks for reaching out.
If you have already converted the Global Block to the Component, you need to use the shortcode respective to the components. Please go through the following article, which may help you with this.

Alternately. I would suggest you use the Footer builder, i.e., exclusively available with Pro, not in X you are using, and create a custom footer and use the component directly inside the Cornerstone as an element.
If you want to upgrade the X to Pro, please go through the process explained here in this article: https://theme.co/docs/converting-from-x-to-pro.

If that is not the case and you are trying to point out something else, please provide a screenshot marked with the issue or any video that helps us to recognize the problem.

Thanks

Hi @tristup,

Thanks for your reply!

I didn’t have to convert the Global Block to the Component, it did it automatically.

Thanks for the article, I followed it to get the component shortcode. I then replaced the global block shortcode in the functions.php file with the component shortcode, but it’s not displaying on the website. Other than the shortcode, does any of the script need to change for it work?

I’ll put the details in a secure note.

Thanks!

Hey @core365,

Our staff are located geographically and have different IPs.

By the way, I think you need to update the action hook in your code. Check out the available hook for the footer here:

  • See the code in the secure note below.

Thanks.

Hi @ruenel,

Thanks for the updated code, however it’s still not working. The component isn’t displaying above the footer. I don’t know what the issue is with it.

Thanks!

Hi @core365,

The action hook x_before_view_footer_base is correct to show the content before the footer, but it seems that the component shortcode is not working correctly. I have tried with the following one and it worked correctly.

[cs_component id="ZKnZ7SO88hGIcSNwkU"]

Code will look like the following:

add_action( 'x_before_view_footer_base', 'x_print_footer_global_block' );
function x_print_footer_global_block(){
    echo do_shortcode( '[cs_component id="ZKnZ7SO88hGIcSNwkU"]' );
}

Please check the component you are using and try it again. If you are still having the same issue, please let us know the component name which you are using.

Thanks

Hi @tristup,

That worked, thank you!

Can you give me step by step instructions how I find out the component shortcode please, as I tried to follow the article that was previously supplied but I must have done it wrong!

Thanks!

Hi @core365,

In the screenshot below, screenshot added in the following article, you can see the shortcode is shown.

Hope it helps.
Thanks

Hi @tristup,

That’s great, thanks!

Many thanks for your time and help!

Thanks!

You are most welcome, @core365

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