Browser: Chrome 128.0.6613.32 OS: Windows 11 URL: N/A
Hi, I’m facing an issue where condition logic show/hide custom term (created using Metabox AIO) are not working on the SECTION, the same condition logic (custom term) does work on ELEMENT but it does not work on SECTION area.
Yes it does output “2023-2024” string for the basic text.
Yes it does seem weird and probably I may need to provide you login credentials to check it out. It is installed with the latest Bricks Builder.
Both websites are in the same server, but it’s 2 different sub-domain, therefore it’s different wordpress environment. Both are in latest Bricks Builder, 1 of it working normally for applying conditional logic to the SECTION and another is not
I applied the following code on code snippets (plugin used Advanced Script) to dynamically show/hide condition based on the class “logged-in” / “logged-out” with the below code:
<?php
add_filter( 'bricks/element/render', function( $render, $element ) {
// Get the element CSS classes
$classes = ! empty( $element->attributes['_root']['class'] ) ? $element->attributes['_root']['class'] : false;
// Check if the element has the special class "logged-in"
if ( $classes && in_array( 'logged-in', $classes ) ) {
return is_user_logged_in();
}
// Check if the element has the special class "logged-out"
if ( $classes && in_array( 'logged-out', $classes ) ) {
return ! is_user_logged_in();
}
return $render;
}, 10, 2 );
The above code affected SECTION unable to conditional Show/Hide, this does not affect the ELEMENT. The above code has been applied previously and has no issue, but currently it’s not working on the latest Bricks Builder. Is it possible to remain the code snippet as I would need that to show/hide based on logged in user
so this code is not working for you? I tested on 1.10.1 version, and it seems to me that it’s working. I tested on section and container.
Can you check that you are on 1.10.1 (hotfix) version, and not only on 1.10?
If you are, and this code is still not working for you, can you send temporary login credentials to your test server and a link to this thread to help@bricksbuilder.io using the email address you used during the purchase, so we can take a look?
Additionally, I would also like to see why that “contain” is not working for you, so I may have a look at that also.
Yes, it is 1.10.1 version, the code is working for the website. But if above code is applied to the website, conditional logic will not be working properly on the Section but Element is working fine.
I have sent you the login credentials for you to take a look.
Hi. I don’t whether if I should create a new topic but I have similar issue with OP, except mine is also not working with elements.
I’m trying to output element only when the CPT (metabox) has the term ‘land’ assigned to it. In the post editing page, it shows that the term is already registered but in Bricks, using neither ‘land’ or the Term ID, as a condition, is not working.
can you try insted of != to set does not contain and land as a value? Does this work? If land is a slug, then instead of land make sure to write whatever the name of property-type is.
Just an update on the post: We discussed over the email, with a bit more information and we got to the conclusion that the logic in the PHP filter is a bit wrong. We fixed that and it’s working.
The main thing was that when checking conditions, first we check if conditions that are added via UI are met, and only then do we run this trough the filter, so we had to adapt the code for this case.
And since this was not a bug, I’ll mark this as a NO BUG.