Skip to content

Template Overrides

The plugin loads all of its display templates through bp_suggestions_load_template(), which checks your theme directory first. This means you can customize the output without editing plugin files.


When the plugin needs to render a layout, it resolves the template file in this order:

  1. Child theme{child-theme}/buddypress-friend-follow-suggestions/{filename}
  2. Parent theme{parent-theme}/buddypress-friend-follow-suggestions/{filename}
  3. Plugin fallback{plugin}/templates/{filename}

If neither theme directory contains the file, the plugin uses its own template.


Template file Purpose Used by
list-layout.php Vertical list of suggestion cards List widget, [bp_friend_suggestions layout="list"]
horizontal-layout.php Horizontal Swiper slider Horizontal slider widget
horizontal-slider-layout.php Full-featured Swiper with nav/pagination Swiper widget variant

Copy the template you want to modify from the plugin into your theme:

Terminal window
# Example: override the list layout
mkdir -p your-theme/buddypress-friend-follow-suggestions/
cp wp-content/plugins/buddypress-friend-follow-suggestion/templates/list-layout.php \
wp-content/themes/your-theme/buddypress-friend-follow-suggestions/list-layout.php

Edit the copy in your theme. The plugin will automatically pick it up — no configuration required.


Every template receives a $settings array. The keys present depend on whether the template is loaded by a widget or shortcode:

Key Type Source Description
suggest string All 'friends' or 'follow'
limit int All Maximum members to display
show_reset_button bool Widget Whether to show the “Show New People” button
swiper_autoplay bool Swiper widget Enable autoplay
swiper_autoplay_delay int Swiper widget Delay in milliseconds
swiper_loop bool Swiper widget Enable continuous loop
swiper_slides_per_view int Swiper widget Visible slides at once
swiper_space_between int Swiper widget Gap between slides (px)
swiper_show_navigation bool Swiper widget Show prev/next arrows
swiper_show_pagination bool Swiper widget Show dot pagination
swiper_centered_slides bool Swiper widget Center-align slides

UX settings (dismiss button, match details) are read directly from BFFS_UX inside the template — they are not passed through $settings.


The bffs/suggestions block uses a separate render file that also supports theme overrides:

{theme}/buddypress-friend-follow-suggestion/blocks/suggestions/render.php

Note the singular form (buddypress-friend-follow-suggestion) rather than the plural form used by widget/shortcode templates. The block’s render file is a thin loader — copy the plugin’s blocks/suggestions/render.php and place it at the path above.


Rather than copying full templates, consider hooking into the template actions to inject content at specific points. This approach survives plugin updates without requiring you to re-merge template changes:

// Add a "New Member" badge after every avatar, without overriding the template
add_action( 'bffs_after_member_avatar', function( $member_id, $settings ) {
$registered = get_userdata( $member_id )->user_registered;
if ( strtotime( $registered ) > strtotime( '-7 days' ) ) {
echo '<span class="bffs-new-member-badge">' . esc_html__( 'New', 'your-text-domain' ) . '</span>';
}
}, 10, 2 );

All layouts output consistent class names. Use these in your theme stylesheet to adjust appearance:

Class Element
.bffs_swiper_layout_wrapper Swiper container
.bffs_horizontal_layout Horizontal layout container
#members-list List/horizontal layout <ul> or <div>
.bffs-slide.swiper-slide Individual slide in Swiper layout
.item-entry Individual member card (bp_member_class() target)
.item-avatar Avatar wrapper
.item-title.fn Member name
.bffs-dismiss-suggestion “Not Interested” button
.bffs-show-match-details “Show Match Details” button
.bffs-match-details-container Expandable match details panel
.bffs-reset-container “Show New People” button wrapper
.bffs-reset-suggestions “Show New People” button
.member-status.online Online indicator dot

All built-in templates use is_rtl() to load RTL-specific stylesheets. If you replace a template, keep the RTL stylesheet loading in place:

if ( is_rtl() ) {
wp_enqueue_style( 'your-bffs-rtl', get_stylesheet_directory_uri() . '/css/bffs-rtl.css' );
}