What exactly are Global Sections?
This is a feature we have developed to allow embeddable content with a “single source of truth”.
They depend on Elementor Page Builder, so make sure you have it installed already.
Types of Global sections:
Global sections can be used for any type of content such as:
- Site Header (how to create headers)
- Site Footer (how to create footers)
- Covers (top banners) (how to create page covers)
- Generic sections (how to create generic sections)
- Mega menu content (how to create mega menu global sections)
To create a Global section, access Rey theme > Global section and click on Add new.
Assigning Global Sections on the entire site
This can be done by accessing Customizer > General Settings > Global sections. Please note that only “Generic” sections can be assigned.
After you created a Generic Global Section, you will need to select it and its position in the site eg https://d.pr/i/Xw1zDF .
Assigning a Global Section on a specific page/archive
Simply edit the page you want and look for the Advanced tab of the “Singular Settings” panel eg https://d.pr/i/MMM8wP .
Adding Global Section anywhere with shortcode
You can publish a Global section by adding a shortcode where you want. To find the shortcode, please access in the backend Rey Theme > Global sections and look at the Shortcode column. You will find the autogenerated shortocode, eg:
[[rey_global_section id="743"]]
Programatically add Global Sections
You can publish Global Sections per specific post types, taxonomies, archives or mostly anything that you want group based.
add_action( "rey/before_site_wrapper", function(){ if( ! class_exists('\ReyCore\Elementor\GlobalSections') ){ return; } // Check for WooCommerce // and apply on all Product Categories if( class_exists('\WooCommerce') && is_product_category() ){ // The generic global section's post ID // you want to publish; $global_section_id = 101; echo \ReyCore\Elementor\GlobalSections::do_section( $global_section_id ); } });
In the example above we’re adding a Global Section in all Product categories, before the site wrapper (find positions below).
You can use pretty much any WordPress Conditional Tags or WooCommerce Conditional Tags to match the page locations.
Another approach is by using shortcodes eg:
add_action( "rey/before_site_wrapper", function(){ if( class_exists('WooCommerce') && is_product_category() ){ echo do_shortcode('[[rey_global_section id="743"]]'); } });
Available site positions where you can publish Global Sections
Before site wrapper .
Hook: rey/before_site_wrapper
.
Before header .
Hook: rey/before_header
.
After Header .
Hook: rey/after_header
.
Before site container .
Hook: rey/before_site_container
.
After site container .
Hook: rey/after_site_container
.
Before footer .
Hook: rey/before_footer
.
After footer .
Hook: rey/after_footer
.
After site wrapper .
Hook: rey/after_site_wrapper
.
One Reply to “Global Sections”
Kuba
Hello,
how to hook related product block after global sections used in Generic Section List for all products? I want to have some custom global sections in position: “After Site Container” and related product widget after them.
I tried multiple php solutions but I failed 🙂
thanks in advance