Hello! what about adding a global block before the footer content?
Here you told me how to add before the site end:
thank you
Hello! what about adding a global block before the footer content?
Here you told me how to add before the site end:
thank you
Hey @dcheese,
Thanks for writing in!
To display the global block before the footer content, you can make use of this code instead:
function add_global_block() {
echo do_shortcode('[your global block shortcode]');
}
add_action( 'x_before_view_global__footer_widget-areas', 'add_global_block', 10 );
And if you only want the global block in single posts, you can make use of this code:
function add_global_post() {
if( is_singular('post') ){
echo do_shortcode('[your global block shortcode]');
}
}
add_action( 'x_before_view_global__footer_widget-areas', 'add_global_post', 10 );
We would love to know if this works out for you.
Nothing happens with this code
Hey @dcheese,
Try replacing the previous code with the following:
function add_global_block() {
echo do_shortcode('[your global block shortcode]');
}
add_action( 'x_before_the_content_end', 'add_global_block', 10 );
Don’t forget to replace the [your global block shortcode]
with your actual Global Block shortcode. Let us know how this goes!
Added this (I need a global block on the single post pages):
function add_global_block() {
if( is_singular(‘post’) ){
echo do_shortcode(’[cs_gb id=4126]’);
}}
add_action( ‘x_before_the_content_end’, ‘add_global_block’, 10 );
It works but I need a global block without margins.
Hi @dcheese,
In that case, update x_before_the_content_end to get_footer. So the code will look like this.
function add_global_block() {
if( is_singular('post') ){
echo do_shortcode('[cs_gb id=4126]');
}
}
add_action( 'get_footer', 'add_global_block', 10 );
To set the global block without margin, you will also need to set the Inner Container
off in the global block’s row.
Hope this helps.
Thanks
Perfect! thank you!
You are most welcome.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.