Skip to content

Instantly share code, notes, and snippets.

@itsdavidmorgan
Last active December 6, 2019 19:23
Show Gist options
  • Save itsdavidmorgan/f4341d1b5acdce3cd1e0b8e4abeaf510 to your computer and use it in GitHub Desktop.
Save itsdavidmorgan/f4341d1b5acdce3cd1e0b8e4abeaf510 to your computer and use it in GitHub Desktop.
Register Forum Sidebar
if ( ! function_exists( 'my_theme_widgets_init' ) ) :
/** Function my_theme_widgets_init */
function my_theme_widgets_init() {
if ( class_exists( 'bbPress' ) ) {
register_sidebar(
array(
'name' => esc_html__( 'Forums Sidebar', 'my-theme' ),
'id' => 'sidebar-forum',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
}
}
endif;
add_action( 'widgets_init', 'my_theme_widgets_init' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment