How to add multiple elements with Ex2-Theme header and footer builder?
Add multiple items with Ex2-Theme header and footer builder
The Ex2-Theme construction tool provides you with various elements that can be added to the header and footer sections:
Button
HTML
Widget
Social
When you use only the free version of Ex2-Theme, the number of each of these elements is limited. But Ex2-Theme Pro allows you to extend that.
For example, the free theme comes with a button available. When you activate the Ex2-Theme Pro version, you will have two buttons available by default. In addition to having more default items, the Pro version gives you the option to increase the number of buttons to have more than two buttons.
You can also do this for most other elements of your header and footer builder. You can add multiple elements for HTML code elements, widgets and or links to your social media.
Steps to add multiple items (button, HTML, widget and social):
Step 1: Make sure that the Ex2-Theme Pro plugin is enabled.
Step 2: You will need to add a custom code for several items, so make sure the Ex2-Theme child theme is installed and enabled.
Step 3: Modify the functions.php file of the Ex2-Theme child theme and add the following custom code. You can add only mandatory fields from the
following code:
/**
* Update the count of elements in HF Builder.
*
* @param array $elements array of elements having key as slug and value as count.
* @return array $elements
*/ function astra_builder_elements_count( $elements ) {
$elements['header-button'] = 3;
$elements['footer-button'] = 3;
$elements['header-html'] = 3;
$elements['footer-html'] = 3;
$elements['header-widget'] = 3;
$elements['footer-widget'] = 3;
$elements['header-social-icons'] = 3;
$elements['footer-social-icons'] = 3;
return $elements;
}
add_filter( 'astra_builder_elements_count',
'astra_builder_elements_count', 10 );
In the code above, you see values defined for each header and footer element. You can change the code and set the value to match the number of items you need. In the code above, these values are set to 3 as an example.
So, if you rather need 6 widgets available in the footer builder, then the edited code should look like this:
/**
Update the count of elements in HF Builder.
* @param array $elements array of elements having key as slug and value as count.
@return array $elements
*/
function astra_builder_elements_count( $elements ) {
$elements['footer-widget'] = 6;
return $elements;
}
add_filter( 'astra_builder_elements_count',
'astra_builder_elements_count', 10 );
```
This can be done for any header or footer element.
Updated on: 27/03/2023
Thank you!