Archived topic
Page Header & BuddyPress
6 replies · Started by Stephane on October 21, 2014
Hello Tom,
The "Page Header" Add-on seems not to be working with a activity, groups or members page. Do you have this issue? Is it compatible?
Thanks,
Stephane.
Hi Stephane,
BuddyPress sets these pages up like a WordPress blog, which ignores any metabox options set on the page itself (unfortunately).
As of right now, you would have to use GP Hooks to add a page header to these pages (I can provide code if you like).
In the future, I plan on having a settings page that allows you to set a header easily on the Blog, and on BuddyPress pages (plus more) - just trying to figure out the best way to approach it.
Let me know if you'd like the code for GP Hooks :)
Thanks!
Thanks. Yes, I would like to have the process. Thanks.
Ok, here we go :)
First off, you'll need to use GP Hooks - we'll be working inside the "After Header" hook.
Basically, we need to target which BuddyPress page we're on using PHP.
Luckily, BP provides us with some conditionals to work with: https://codex.buddypress.org/developer/bp-is-active/
So to target the activity page, we would do this inside the hook:
https://gist.github.com/generatepress/ba49bc497a9571038a42
Then we would duplicate the above for the other components, the only important part is to change the name of the component on this line:
<?php if ( bp_is_active( 'activity' ) ) { ?>
So the above would be for the activity page.
This would be for the groups page:
<?php if ( bp_is_active( 'groups' ) ) { ?>
And so on.
It's complicated, but achievable.
Like I said - I hope to add options to use the Page Header addon on all of these pages.
Let me know if you have any issues :)
Whooo! Thanks you very much! I try it and I give you a return.
Hey Tom,
I bought GP a couple days ago.
I'm trying to style the BP related pages a bit, especially the Profile Page. Eg hiding the title..
There was no further development in this direction or?
Best regards,
Dorian
Hi Dorian,
It would be best if you could create a new topic with more details on what you're trying to achieve. Then I'll try my best to help you :)