Skip to:
Content
Pages
Categories
Search
Top
Bottom

Left sidebar in bp-default theme

  • Avatar of samm8158
    samm8158
    Participant

    @samm8158

    Hi there,

    I am using bp-dafault theme..I am loving it..I am using child theme created by me using the same features..
    I created function.php and registered the sidebar by copying the same code as of right sidebar. Changed its name to Left sidebar, and id to primary..
    Copied sidebar.php and renamed it to sidebar-primary.php…changed the following code
    div id is sidebar-primary and <?php dynamic_sidebar( ‘primary’ ); ?>
    In sidebar.php on the first line I put in the code:
    <?php get_sidebar( ‘primary’ ); ?>
    Now what to do please help me out..I dont know coding..
    Please help out as early as possible..

    Warm regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of aces
    aces
    Participant

    @aces

    @samm8158

    You need to register_sidebar()

    I recently upgraded from bp-columns – starting fresh as a child of bp-default using the following:

    add_action( 'widgets_init', 'bpcol_register_sidebars' );
    
    function bpcol_register_sidebars() {
    register_sidebar(
    	array(
    		'id' => 'left-sidebar',
    		'name' => 'Left Sidebar',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">',
    		'after_widget' => '</div>',
    		'before_title' => '<h3 class="widgettitle">',
    		'after_title' => '</h3>'
    	)
    );
    }
    

    This went in the functions.php file – adapt to suit your situation…

    You will also need something like <?php get_sidebar(); ?> in your template files
    ( adapt to suit ) …

    Avatar of samm8158
    samm8158
    Participant

    @samm8158

    @aces
    Thanks for your reply..I think I was not clear with my question which is as follows:

    This is what I have done till now in functions .php file
    <?php
    if ( !function_exists( ‘bp_dtheme_widgets_init’ ) ) :
    function bp_dtheme_widgets_init() {

    register_sidebar( array(
    ‘name’ => ‘Right Sidebar’,
    ‘id’ => ‘sidebar-1′,
    ‘description’ => __( ‘The sidebar widget area’, ‘buddypress’ ),
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h3 class=”widgettitle”>’,
    ‘after_title’ => ‘</h3>’
    ) );

    register_sidebar( array(
    ‘name’ => ‘Left Sidebar’,
    ‘id’ => ‘primary’,
    ‘description’ => __( ‘The left sidebar widget area’, ‘buddypress’ ),
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h3 class=”widgettitle”>’,
    ‘after_title’ => ‘</h3>’
    ) );
    }
    add_action( ‘widgets_init’, ‘bp_dtheme_widgets_init’ );
    endif;
    ?>

    Then I created the sidebar-primary.php file with the following code:
    <?php do_action( ‘bp_before_sidebar’ ); ?>

    <div id=”sidebar-primary” role=”complementary”>
    <div class=”padder”>

    <?php do_action( ‘bp_inside_before_sidebar’ ); ?>

    <?php if ( is_user_logged_in() ) : ?>

    <?php do_action( ‘bp_before_sidebar_me’ ); ?>

    <div id=”sidebar-me”>
    <?php do_action( ‘bp_sidebar_me’ ); ?>
    </div>

    <?php do_action( ‘bp_after_sidebar_me’ ); ?>

    <?php if ( bp_is_active( ‘messages’ ) ) : ?>
    <?php bp_message_get_notices(); /* Site wide notices to all users */ ?>
    <?php endif; ?>

    <?php else : ?>

    <?php do_action( ‘bp_before_sidebar_login_form’ ); ?>

    <?php if ( bp_get_signup_allowed() ) : ?>

    <?php endif; ?>

    <form name=”login-form” id=”sidebar-login-form” class=”standard-form” action=”<?php echo site_url( ‘wp-login.php’, ‘login_post’ ); ?>” method=”post”>
    <?php do_action( ‘bp_sidebar_login_form’ ); ?>

    <input type=”hidden” name=”testcookie” value=”1″ />
    </form>

    <?php do_action( ‘bp_after_sidebar_login_form’ ); ?>

    <?php endif; ?>

    <?php /* Show forum tags on the forums directory */
    if ( bp_is_active( ‘forums’ ) && bp_is_forums_component() && bp_is_directory() ) : ?>
    <div id=”forum-directory-tags” class=”widget tags”>
    <h3 class=”widgettitle”><?php _e( ‘Forum Topic Tags’, ‘buddypress’ ); ?></h3>
    <div id=”tag-text”><?php bp_forums_tag_heat_map(); ?></div>
    </div>
    <?php endif; ?>

    <?php dynamic_sidebar( ‘primary’ ); ?>

    <?php do_action( ‘bp_inside_after_sidebar’ ); ?>

    <?php wp_meta(); ?>

    </div><!– .padder –>
    </div><!– #sidebar –>

    <?php do_action( ‘bp_after_sidebar’ ); ?>
    Then In sidebar.php on the first line I put in the code:
    <?php get_sidebar( ‘primary’ ); ?>
    Now what to do..

    Warm Regards,

Viewing 2 replies - 1 through 2 (of 2 total)

The forum ‘BP-Default’ is closed to new topics and replies.