- This topic has 26 replies, 3 voices, and was last updated 3 years, 6 months ago by Tom.
-
AuthorPosts
-
October 16, 2020 at 2:01 pm #1492541Carsten
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 #1492964DavidStaffCustomer SupportHi there,
where can i see the Activity page ?
October 17, 2020 at 6:49 am #1493097CarstenHi there, the activity page is the landing page when you login.
Thanks
October 17, 2020 at 6:53 am #1493102DavidStaffCustomer 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 #1493106CarstenThis Block element, containing a WooCommerce block
October 17, 2020 at 6:59 am #1493108CarstenIf I change the location to entire site it will show up
October 17, 2020 at 7:31 am #1493135DavidStaffCustomer SupportI am seeing another body class of
directory
on that page. Is Directory a location option in the elements ?October 17, 2020 at 11:05 am #1493494CarstenI’m not sure what you mean?
October 18, 2020 at 12:01 am #1493880DavidStaffCustomer SupportIn the Body classes you can see before
activity
– which is the page slug you’re currently using there is thedirectory
class – In the Element > Display Rules – is Directory a location eg. Directory > Activity or Pages > Directory for example.October 19, 2020 at 7:37 am #1495522CarstenHi there, can’t tell how and why this
directory
appears, 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 #1496135TomLead 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 #1496216CarstenHi 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 #1497366TomLead 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
123
with the ID of the Element and it should work.October 20, 2020 at 11:02 am #1497456CarstenHi 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 #1497646TomLead 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.