![](https://beanscommunity.wpenginepowered.com/wp-content/uploads/beans/images/745a174c643b049cd050c2f2734d320e-87a1c39.jpg)
Hey @Thierry
I'm working on the theme I mentioned the other day and have a quick question about swapping out the primary sidebar widgetarea for a page specific one. Ie, load the frontpage widgets on the frontpage and the default primary sidebar widgets on the blog.
Got any ideas?
Chris
![](https://beanscommunity.wpenginepowered.com/wp-content/uploads/beans/images/c70294be72623e3f8995ee4832f8d065-87a1c39.jpg)
Hi Chris,
There are multiple approach depending on your needs. If it is just to have a different widget area on the home page, I would suggest to register another sidebar and display it instead of the default primary sidebar on the front page as follow:
add_action( 'widgets_init', 'example_widgets_init', 2 );
/**
* Register example widget area.
*/
function example_widgets_init() {
beans_register_widget_area( array(
'name' => __( 'Sidebar Primary Alt', 'smartcom' ),
'id' => 'example_primary_alt',
) );
}
beans_modify_action_callback( 'beans_widget_area_sidebar_primary', 'example_widget_area_sidebar_primary' );
/**
* Echo primary widget area alt on front page and default primary widget area elsewhere.
*/
function example_widget_area_sidebar_primary() {
// Load the primary alt sidebar on the front page.
if ( true === is_front_page() ) {
echo beans_widget_area( 'example_primary_alt' ); // WPCS: XSS ok.
return;
}
beans_widget_area_sidebar_primary();
}
If you needed that to be "controllable" in the backend layout options, then you would need hook into beans layout options to register an new layout option and a listener for it in your callback function.
Have fun,
![](https://beanscommunity.wpenginepowered.com/wp-content/uploads/beans/images/745a174c643b049cd050c2f2734d320e-87a1c39.jpg)
Thanks dude, that's exactly what I was after 😀