Okay
  Public Ticket #155806
bbpress sidebar
Closed

Comments

  • Nyalus started the conversation
    Hey Nectar, I was following the advice on http://themenectar.ticksy.com/ticket/150515 to get a sidebar for bbpress. So I created a bbpress.php and the pages now have a sidebar but unfortunately I think I need to register a sidebar for bbpress in the functions. I tried my hand at it and unfortunately failed to get it to work properly (got it to show but none of the widgets worked). Obviously I am missing something, wondering if I could get some assistance :O
  •  1,077
    ThemeNectar replied

    Hey Nyalus!

    If you're talking about creating a sidebar exclusivity for use within bbpress pages then here's the process:

    1. Open up the functions.php file and head to this section

    if(function_exists('register_sidebar')) {
    	
    	register_sidebar(array('name' => 'Blog Sidebar', 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget'  => '</div>', 'before_title'  => '<h4>', 'after_title'   => '</h4>'));
    	register_sidebar(array('name' => 'Page Sidebar', 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget'  => '</div>', 'before_title'  => '<h4>', 'after_title'   => '</h4>'));
    	register_sidebar(array('name' => 'WooCommerce Sidebar', 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget'  => '</div>', 'before_title'  => '<h4>', 'after_title'   => '</h4>'))

    and change it to:

    if(function_exists('register_sidebar')) {
    	
    	register_sidebar(array('name' => 'Blog Sidebar', 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget'  => '</div>', 'before_title'  => '<h4>', 'after_title'   => '</h4>'));
    	register_sidebar(array('name' => 'Page Sidebar', 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget'  => '</div>', 'before_title'  => '<h4>', 'after_title'   => '</h4>'));
    	register_sidebar(array('name' => 'WooCommerce Sidebar', 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget'  => '</div>', 'before_title'  => '<h4>', 'after_title'   => '</h4>'))
            register_sidebar(array('name' => 'BBPress Sidebar', 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>', 'before_title' => '<h4>', 'after_title' => '</h4>'))
    

    now there will be a new sidebar area in your appearance > widgets section in the admin panel. After that to get it to show on your page open up your bbpress.php file  (which you created based off the page-sidebar.php file) and change this part:

    <div id="sidebar" class="col span_3 col_last">
    	<?php get_sidebar(); ?>
    </div><!--/span_9-->

    to this:

    <div id="sidebar" class="col span_3 col_last">
    	<?php dynamic_sidebar('BBPress Sidebar'); ?>
    </div><!--/span_9-->

    Cheers :)

  • Nyalus replied

    I'd kiss you if I could. Thanks!