Footer Widgets

There are 5 footer widget areas in GeneratePress. You can choose whether to display 0 – 5 of them at any time.

Global setting

You can find the global setting to set the number of footer widgets in Customize > Layout > Footer.

Change the number of footer widgets on individual pages/posts

Some individual pages and posts might require a different number of footer widgets than your global settings. In this case, you can use the meta box while editing that page/post.

Changing the numbers of widgets using a filter

Sometimes, the global settings and individual meta box won’t be enough, and you’ll have tougher conditionals to meet like specific archive pages, categories or custom post types.

In these cases, you can use the filter to set your number of footer widgets.

For example, if we want to target WooCommerce:

add_filter( 'generate_footer_widgets','tu_custom_woocommerce_footer_widgets' );
function tu_custom_woocommerce_footer_widgets( $widgets )
{
 	// If we are on a woocommerce page, set the number
 	if ( function_exists( 'is_woocommerce' ) && is_woocommerce() )
 	 	return '2';

 	// Or else, set the regular number
 	return $widgets;

 }

Or we can target categories:

add_filter( 'generate_footer_widgets','tu_custom_category_footer_widgets' );
function tu_custom_category_footer_widgets( $widgets )
{
 	// If we are on a category, set the number
 	if ( is_category() )
 	 	return '4';

 	// Or else, set the regular number
 	return $widgets;

 }

Another example is targeting the search results page:

add_filter( 'generate_footer_widgets','tu_custom_search_footer_widgets' );
function tu_custom_search_footer_widgets( $widgets )
{
 	// If we are on a category, set the number
 	if ( is_search() )
 	 	return '1';

 	// Or else, set the regular number
 	return $widgets;

 }

You can use any of the available WordPress conditionals to determine your sidebar layout.

These are the available IDs you can return:

0
1
2
3
4
5

Learn how to add PHP here.

Choosing different widths for each widget area

It’s also possible to change the widths of each widget area in the footer using the following filters:

generate_footer_widget_1_width
generate_footer_widget_2_width
generate_footer_widget_3_width
generate_footer_widget_4_width
generate_footer_widget_5_width

For example:

add_filter('generate_footer_widget_1_width','tu_custom_footer_1_width');
function tu_custom_footer_1_width(){
    // Return the percentage of this widget width - 25% in this case
    return'25';
}

It’s important to set these widths for all present footer widgets, and that in the end they equal 100.

Learn how to add PHP here.