Sidebars

Sidebars in Page Builder Framework are super powerful. By default, the position of the sidebars can be changed:

  • globally, for all archives & post types on the website (General -> Sidebar)
  • globally, for all archives on the website (Blog -> Blog / Archive Layout)
  • globally, for all post types (Blog -> Post Layout)
  • individually, for each post and page (on the create new/edit post/page screen -> Sidebar tab on the right hand side)

This allows for great flexibility when displaying sidebars.

The options you get when changing the sidebar positions are as follows.

  • Inherit Global Settings – This will inherit the global settings – if configured – respecting the hierarchy above.
  • Right Sidebar – Will display the sidebar on the right side
  • Left Sidebar – Will display the sidebar on the left side
  • No Sidebar – Will disable the sidebar

More Granular Control with the Premium Add-On

With the Premium Add-On installed you get even more granular control over the sidebar positions when working with our Blog Layouts feature. With Blog Layouts enabled for your post archive, custom post type archive or custom post types, sidebars can be managed individually for each available archive type & post type on your website.

Use a Filter to Dynamically Change the Sidebar Position

There is a filter available that allows you to change the sidebar position or disable the sidebar based on your own conditions.

In the example below we use the filter to add a sidebar to all pages on our website. Remember you could simply set the sidebar position from the right hand side on the add page/edit page screen but this would be a tedious task if you plan to use the sidebar on all of your pages.

function prefix_page_sidebar( $layout ) {

	// Stop here if we're not on a page.
	if ( ! is_page() ) {
		return $layout;
	}

	// Set the sidebar position to right if we are on a page.
	return 'right';

}
add_filter( 'wpbf_sidebar_layout', 'prefix_page_sidebar' );

Last updated on: September 1st, 2022


Related Articles

Scroll to Top

Download

Download Page Builder Framework and be the first to get informed about new features & updates!

OR

Get 10% off our Premium Add-On (yearly plan).
Coupon Code to enter during checkout: 10OFF View Pricing