Global Sections

You are here:
Estimated reading time: 1 min

LinkWhat 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.

LinkTypes of Global sections:

Global sections can be used for any type of content such as:

To create a Global section, access Rey theme > Global section and click on Add new.

LinkAssigning 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 .

LinkAssigning 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 .

LinkAdding 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"]]

LinkProgramatically 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"]]');
    }
});

LinkAvailable 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 .

Was this article helpful?
Dislike 1
Views: 3865

One Reply to “Global Sections”

  1. 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

Suggest article improvements

Please use this form to suggest improvements and report missing or outdated content. Support requests will most likely not be answered and it's best to use the Support Request Form instead. Thanks!