- This topic has 7 replies, 3 voices, and was last updated 3 years, 7 months ago by
David.
-
AuthorPosts
-
August 11, 2022 at 11:34 am #2310340
Cheryl
Hi,
I have a GP block element that is a page hero that gets applied to most pages on my site.However, I do NOT want it on BuddyPress pages. I tried excluding the page itself — excluding it from the login page worked, but the main BP page /user/ has many child pages and if I exclude Page:User the page hero remains on the user page and all of its children.
Is there a way I can exclude a block element from all BuddyPress pages?
ThanksAugust 11, 2022 at 5:50 pm #2310506Ying
StaffCustomer SupportHi Cheryl,
Can you try this snippet? Replace 951 with the element’s ID, and 77 with the parent page ID.
add_filter( 'generate_hook_element_display', function( $display, $element_id ) { global $post; if ( 951 === $element_id && ( is_page() && $post == post_parent > 77 || is_page(77)) ) { $display = false; } return $display; }, 10, 2 );Let me know if this works.
August 11, 2022 at 7:08 pm #2310539Cheryl
No, unfortunately, that didn’t do it. I saw a snippet like that in another post in the forum here and had tried it.
I’ve tried excluding the member page, the groups page, and the register page this way and it doesn’t work. Neither does excluding those pages on the Page Hero element itself.
I suppose I could INCLUDE the page hero only on select pages but that would be very cumbersome and take a lot of time. But as a last resort, I could do it…though it would be nice if there were a way to exclude it from any BuddyPress page.
Somehow, excluding the Buddypress login page in the element DOES work and removes the page hero element there.
Thanks.August 12, 2022 at 4:11 am #2310783David
StaffCustomer SupportHi there,
try this snippet:
add_filter( 'generate_element_display', function( $display, $element_id ) { if ( 10 === $element_id ) { if ( function_exists( 'is_buddypress' ) && is_buddypress() ) { return false; } } return $display; }, 10, 2 );Change the
10to the ID of the Element.
This should disable that element wherever Buddypress templates are loaded.August 12, 2022 at 7:26 am #2310935Cheryl
Hi,
Thanks for the snippet. Unfortunately, that also did not work. I also found and tried the snippet to exclude the element from pages that have the featured image disabled. That also did not work in this case.But I went ahead and added some CSS to move the box around the membership page fields up so they overlap the blank page hero. This looks good enough to me.
Thanks again for the help.
August 12, 2022 at 7:32 am #2310946David
StaffCustomer SupportDoh — i made a mistake in the Code here:
just updated that if you want to give it another go.
August 12, 2022 at 7:58 am #2311101Cheryl
That worked beautifully! Thanks!
CherylAugust 12, 2022 at 8:01 am #2311104David
StaffCustomer SupportGlad to hear that!
-
AuthorPosts
- You must be logged in to reply to this topic.