Add Multiple Elements in Header Footer Builder

Astra Header Footer Builder allows you to add following elements to header and footer sections –

  • Button
  • HTML
  • Widgets
  • Social
  • More will be added in future

In free Astra theme number of these elements are limited but with Astra Pro you can extend it.

For example – If you click to add new element in the header you will notice two buttons available.

But with Astra Pro you can extend number of buttons available for use and can have more than two buttons.

Not just button, you can add multiple number of elements for HTML, widget and social.

Steps for Adding Multiple Elements (Button, HTML, Widget, and Social)

Step 1 – Make sure to have Astra Pro plugin activated.

Step 2 – You will need to add custom code for multiple elements so make sure to have Astra child theme installed and activated.

Step 3 – Edit Astra child theme’s functions.php file and add following custom code. You can add only required fields from 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 above code you will observe different parameters for all elements in header and footer. You can set required count for all parameters. In above code it is set to 3 for demo purpose.

You can edit above code as per requirement of elements and its number.

For example – Lets say you need 6 widgets in footer builder. So code you can use is –

/**
 * 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 );

Similarly, you can choose a parameter and set required number.

Not the solution you are looking for? Check other articles, or open a support ticket.