Can a Global Block go above the header landmark on every page?

Hi, I’m working on a site and I’ve added some code to the functions.php file so it adds a global block under the header on every page. The only thing is, it appears under the header landmark on the product pages and I’d like it to go above the landmark. Is there a way of doing this? I’ve searched the forum and can’t find anything!

I’ll put the URL in a secure note as it’s being built on a temp link.

Here’s the code I’ve used:

add_action( 'x_after_view_header_base', 'add_global_header' );
function add_global_header() {
	echo do_shortcode('[cs_gb id=183]');
}

I’d be grateful of any help!

Thanks!

Hi core365,

It can be by changing the hook.
You can use another hook x_after_masthead_end to call your function insetad of x_after_view_header_base

I have tested the below code in my site and seems it working. If it doesnot work at your end, it might be conflicting with something.
And we could not dive into fixing the custom code, as we dont offer custom code fixes.

add_action( 'x_after_masthead_end', 'add_global_header' );
function add_global_header() {
	echo do_shortcode('[cs_gb id=183]');
}

I would like suggest you to upgrade X to Pro into the mix. Here’s the link https://theme.co/docs/converting-from-x-to-pro.

Hi @tristup,

Thanks for the code, however it’s not working for me.

Have you got a comprehensive list of hooks available? I could only find this link: https://theme.co/docs/actions-filters-and-hooks but it doesn’t seem to be a full list as the one I used isn’t included x_after_view_header_base

Thanks

Hi core365,

The comprehensive hook list are available at the link you specified.
And hook you have used x_after_view_header_base is in the end of the list x_after_view_{$file}
here {$file} has replaced with header_base.

Hope it helps you on this.

Doh! So it is, I totally missed it! Thanks for pointing it out!

Thanks for your help!

Hi core365,

Glad to help you.

Thanks

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