You can’t do that in PHP. Well, actually you can – but you will break all the styling, as you will filter our header/footer.php files include. So basically it’s not a good idea.
The best idea – to use a child theme. You can than even switch to that child theme for specific pages on your site. One of the ways to do that: https://premium.wpmudev.org/blog/wordpress-different-themes-for-pages/
Another idea – do some magic with BuddyPress templates. It’s totally possible, but you will quite heavily modify them (that will complicate future maintainability).
Also it would be easier to help you if you provided a URL to your site.
Hi Slava,
Thanks for the help 🙂
Wouldn’t I need to be using the BP theme (instead of the plugin) to use child themes?
I’ll have a go with the templates – do you know which ones I would need to modify for this please?
A sample profile can be seen at http://www.theacademygtc.co.uk/buddy-old/test/
Thank again for you help 🙂
Jon
You don’t need a BuddyPress theme, any WordPress theme will work just fine.
You can create a child theme for your current theme and modify BuddyPress behaviour through it. Copy /plugins/buddypress/bp-templates/bp-legacy/buddypress/
to your theme (in root).
Remove everything that you don’t need, and leave only /your-theme/buddypress/members/single
directory. In that dir you should work with home.php
files and others, that are relevant to you.
But now I see that redefining BuddyPress template only won’t work as expected. You also need to create page-members.php
file, where members
– is the slug of you Members Directory page. It should be modified with
if ( bp_is_user() ) {
get_header('slim');
} else {
get_header();
}
and same for get_footer('slim')
instead of the default usage. You will need to create header-slim.php
and footer-slim.php
files as well, and THERE you should remove all your navigation and all markup you don’t want that pages to have.
So yeah, quite a work, but doable once you dive into that. Hopefully I gave you the direction and general idea.
Very useful pointers, Slava. Many thanks from another forum reader/member with a similar question. Answered well!