Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Front.php and BuddyPress 2.6

  • In 2.6 the front.php template was added for member pages. The ticket #6769 mentions the following.

    “I envisage something along the lines of a small dedicated repo on bp github”

    The only reason I mention this is because I am curious on how the example picture

    Was created. I was wondering if the repo did exist so I could grab the front.php template file and thus play with it from there. I apologize in advance if this has been asked before \0

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

  • @mercime
    Keymaster

    @mercime

    @destac There are different ways to implement the new feature. For the screenshot, I did it in 4 simple steps.

    Note that you might need to adjust how the widgets are registered, named, or styled based on your theme.

    1. Registered three new widget areas in the child/theme’s functions.php file.

    <?php // Only add this line if you are adding this to an empty functions.php file
    /**
     * Register three widget areas for Members front page.
     *
     * @since My Child Theme 2.6.0
     */
    function my_child_theme_widgets_init() {
    	register_sidebar( array(
    		'name'          => __( 'bp-members-1st', 'my-child-theme' ),
    		'id'            => 'bp-members-1st',
    		'description'   => __( 'Appears on each member\'s front page.', 'my-child-theme' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</aside>',
    		'before_title'  => '<h2 class="widget-title">',
    		'after_title'   => '</h2>',
    	) );
    
    	register_sidebar( array(
    		'name'          => __( 'bp-members-2nd', 'my-child-theme' ),
    		'id'            => 'bp-members-2nd',
    		'description'   => __( 'Appears on each member\'s front page.', 'my-child-theme' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</aside>',
    		'before_title'  => '<h2 class="widget-title">',
    		'after_title'   => '</h2>',
    	) );
    
    	register_sidebar( array(
    		'name'          => __( 'bp-members-3rd', 'my-child-theme' ),
    		'id'            => 'bp-members-3rd',
    		'description'   => __( 'Appears on each member\'s front page.', 'my-child-theme' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</aside>',
    		'before_title'  => '<h2 class="widget-title">',
    		'after_title'   => '</h2>',
    	) );
    }
    add_action( 'widgets_init', 'my_child_theme_widgets_init' );

    Adjust items registered in child theme based on how your theme is setting up the widget areas.

    2. Created a new file front.php which should be located as follows: wp-content/my-child-theme-folder/buddypress/members/single/front.php
    (Create the buddypress, members, and single directories/folders if you do not have those in your theme yet.)

    Added the following in the front.php file:

    <?php
    /**
     * BuddyPress - Members Front Page
     *
     * @since My Child Theme 2.6.0
     */
    ?>
    
    <div class="bp-member-front-wrap">
    
    	<div class="bp-member-front-1">
    		<?php dynamic_sidebar( 'bp-members-1st' ); ?>
    	</div>
    
    	<div class="bp-member-front-2">
    		<?php dynamic_sidebar( 'bp-members-2nd' ); ?>
    	</div>
    
    	<div class="bp-member-front-3">
    		<?php dynamic_sidebar( 'bp-members-3rd' ); ?>
    	</div>
    
    </div>

    3. Added some styles:

    .bp-member-front-wrap {
    	clear: both;
    	margin-bottom: 2em;
    }
    
    @media screen and (min-width: 46em) {
    	.bp-member-front-wrap {
    		clear: both;
    		margin-bottom: 1em;
    	}
    	.bp-member-front-1,
    	.bp-member-front-2 {
    		float: left;
    		margin-right: 1.5%;
    		width: 32%;
    	}
    	.bp-member-front-3 {
    		float: left;
    		width: 32%;
    	}
    }

    4. Went to Appearance > Widgets and add widgets to the Member Front Page Widget Areas.

    As mentioned above, there are other ways to implement this new feature. Happy customizing!


    Earl_D
    Participant

    @earl_d

    I am curious how to get this to show as a tab in the profile page I implemented everything but there is no home tab just activity. Did I miss something? I am running twenty twelve theme with BP 2.6/WP 4.53.


    Earl_D
    Participant

    @earl_d

    Never mind I got it figured misspelled front.php. Is it possible to change the name of the tab from home to something else

    Amazing thank you and that actually looks pretty straightforward.


    mcarlyle
    Participant

    @mcarlyle

    Hi, Ive spent most the day trying to add widgets to the profile areas and stumbled accross this explanation which seems perfect but doesnt seem to work for me.

    The widget areas are there and populated, and the home tab is displaying, but the widget content doesnt display?

    Is it possible my front.php is not being called for some reason?

    Im using an Avada Child theme, could that be part of the problem?

    Thanks


    rvnamb
    Participant

    @rvnamb

    My widget area is showing only a VIEW link

    Can you please help me to sort out the problem ?

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.