- This topic has 26 replies, 3 voices, and was last updated 5 years, 5 months ago by
Tom.
-
AuthorPosts
-
October 16, 2020 at 2:01 pm #1492541
Carsten
I thought this was solved, but it’s not, Block element content is not displayed on BuddyPress pages, this time the Activity page.
Thanks for looking into this.
October 17, 2020 at 4:09 am #1492964David
StaffCustomer SupportHi there,
where can i see the Activity page ?
October 17, 2020 at 6:49 am #1493097Carsten
Hi there, the activity page is the landing page when you login.
Thanks
October 17, 2020 at 6:53 am #1493102David
StaffCustomer SupportSo i am seeing the ‘secondary’ container with the Visits and Messages elements in the secondary nav …. whats missing?
October 17, 2020 at 6:57 am #1493106Carsten
This Block element, containing a WooCommerce block
October 17, 2020 at 6:59 am #1493108Carsten
If I change the location to entire site it will show up
October 17, 2020 at 7:31 am #1493135David
StaffCustomer SupportI am seeing another body class of
directoryon that page. Is Directory a location option in the elements ?October 17, 2020 at 11:05 am #1493494Carsten
I’m not sure what you mean?
October 18, 2020 at 12:01 am #1493880David
StaffCustomer SupportIn the Body classes you can see before
activity– which is the page slug you’re currently using there is thedirectoryclass – In the Element > Display Rules – is Directory a location eg. Directory > Activity or Pages > Directory for example.October 19, 2020 at 7:37 am #1495522Carsten
Hi there, can’t tell how and why this
directoryappears, here are the locations I have set for the element, the block is outputted on Search and Start, but not on https://domain/activity/Thanks
October 19, 2020 at 12:58 pm #1496135Tom
Lead DeveloperLead DeveloperIt’s possible that the BP pages don’t think they’re static pages, so those rules wouldn’t work.
What David is saying is when you look through the Display Rules, do you see any rules that reference Directory?
When you say you thought this was solved – what steps were taken to solve it in the first place?
October 19, 2020 at 2:00 pm #1496216Carsten
Hi there, I have earlier posted a topic about elements not working with BP pages, at that time, it was the /register page which was the problem. At that time you said it was something you would look into, if there was an easy solution.
Makes sense, I don’t believe BuddyPress uses conventional WordPress conditions (as funny as that is), so our Display Rules aren’t aware of their specific conditions/rules when it comes to displaying.
We’ll see if it’s something easy enough to add compatibility with.
https://generatepress.com/forums/topic/block-element-is-not-displaying/
Therefore I waited for a solution, but of course, I could not expect it to be solved.
The pages /register and /activity are listed in the element, so I expected the block element to work in these pages.
Regards
CarstenOctober 20, 2020 at 9:42 am #1497366Tom
Lead DeveloperLead DeveloperAh, it’s as I said – BP isn’t using the conventional conditions.
You’ll have to do this:
add_filter( 'generate_block_element_display', function( $display, $element_id ) { if ( 123 === $element_id ) { if ( function_exists( 'bp_is_activity' ) && bp_is_activity() ) { return true; } } return $display; }, 10, 2 );Then you just need to update
123with the ID of the Element and it should work.October 20, 2020 at 11:02 am #1497456Carsten
Hi there, thanks for bringing up a solution.
Apparently the code is not working, using the post=42208, which I assume is the id of the element.
I inserted this into the code snippet and added it to my functions.php file, any idea why it should not work with the /activity page?
add_filter( 'generate_block_element_display', function( $display, $element_id ) { if ( 42208 === $element_id ) { if ( function_exists( 'bp_is_activity' ) && bp_is_activity() ) { return true; } } return $display; }, 10, 2 );Thanks!
October 20, 2020 at 1:58 pm #1497646Tom
Lead DeveloperLead DeveloperHmm, instead of this:
if ( 42208 === $element_id ) {Try this:
if ( 42208 === (int) $element_id ) {Any difference?
-
AuthorPosts
- You must be logged in to reply to this topic.