I’d like to prepend some additional information to a custom members directory which filters out a certain set of users, however the standard [bps_directory] shortcode, as per documentation, always replaces the entire page.
Is there any way to have it not do that, or an alternative shortcode? I’m aware I could insert the additional information using a custom members list template, however this is far from ideal as then it would not be directly editable from the backend and also breaks with other plugins, e.g. those for multi-language support.
The [bps_directory] shortcode makes BuddyPress display a members directory, and when BuddyPress displays a members directory it takes over the entire page. It’s not easy to change this behavior.
To add content to a members directory you can use a custom template, as you correctly noted, or use one of the action hooks available in the standard template, e.g. ‘bp_before_directory_members_page’ or ‘bp_before_directory_members_tabs’.
For instance you could add this code to your bp-custom.php:
add_action ('bp_before_directory_members_page', 'my_content');
function my_content ()
echo "<strong>my additional HTML content</strong>";