Skip to content

Instantly share code, notes, and snippets.

@remkus
Forked from srikat/functions.php
Created August 17, 2016 08:18
Show Gist options
  • Save remkus/de9c0542a2fc925bdddf53a7ad098944 to your computer and use it in GitHub Desktop.
Save remkus/de9c0542a2fc925bdddf53a7ad098944 to your computer and use it in GitHub Desktop.
Make BuddyPress Members page obey its Page layout setting in Genesis. https://sridharkatakam.com/make-buddypress-members-page-obey-page-layout-setting-genesis/
<?php
/**
* Make BuddyPress Members page obey its Page layout setting
*/
add_filter( 'genesis_pre_get_option_site_layout', 'sk_do_members_page_layout' );
function sk_do_members_page_layout( $opt ) {
// if the current page is not the members directory, abort.
if ( ! bp_is_members_directory() ) {
return;
}
// get the list of BuddyPress pages from wp_options table
$page_array = get_option( 'bp-pages' );
$opt = get_post_meta( $page_array['members'], '_genesis_layout', true ); // where $page_array['members'] is the ID of BuddyPress Members page
return $opt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment