-
AuthorPosts
-
November 21, 2019 at 5:24 am #1158697
I know this is generally outside the scope of support, but I cannot find anything out there that gives me an idea of how to accomplish this.
I need to make Avia elements conditional on page variables. In this case, I want to turn on tabs on based upon a user’s level. I am not concerned with the latter part, but I wanted to give you a user case.
So, at this point, I think I have tried nearly everything I can think of, short of getting a function written. I tried using Widget Logic and putting shortcode for the elements in there as text. Initially, I put the beginning of the tab_container in a widget, then each tab in a separate widget, followed by the ending tab_container tag in its own widget. That throws some funky layout issues. So, I tried code blocks, though I am not sure I will be able to accomplish what I need. Either way, like the other attempts, did not work. Oh, and I made sure to not not put in tabset ids.
Is there a way to pull widgets in the widget area and pull the design elements out?
If there is any way you can help, I would greatly appreciate it. If I can get this to work, I will have a couple really cool sites to show for others wanting to see the capabilities of Enfold pushed beyond.
November 22, 2019 at 5:45 pm #1159245Hey Jason,
Well, you will need to look into how the Advanced Layout Builder renders the page and make conditional choices at that point.
You can have a look at this file for the starters
/enfold/template-builder.phpBest regards,
VictoriaNovember 22, 2019 at 7:17 pm #1159302Thank you for the starting point. Is there an example Avia Element template? Who and how was the Events Calendar Pro element built? Did they build it, or was it built there?
November 26, 2019 at 11:24 am #1160257Hi,
Thank you for the update.
I put the beginning of the tab_container in a widget, then each tab in a separate widget, followed by the ending tab_container tag in its own widget.
Why do have to separate the tab shortcodes in a separate widget? It’s not going to work. Have you tried adding the tab shortcode in a single text widget?
Best regards,
IsmaelNovember 26, 2019 at 7:46 pm #1160439Hi Ismael,
I was trying various methods to get it to work. I did try separate widgets and combined widgets. They both try to load the footer formatting and it also closed the element before the code is finished.
I was very interested in getting some guidance on creating Avia Elements like what was done for Events Calendar Pro, but have not had much luck getting any guidance to that end. I ended up hiring a developer that has experience modifying these elements, but wish there was a better way to create them. There is so much opportunity to grow the capabilities of Enfold, if we had a better developer resource. This is why other platforms have success, because they allow for extensibility. Visual Composer, Gutenberg, Avada, Beaver Builder, etc., all welcome development of new modules. Please, give us the capability to build upon the platform we love, so we don’t have to eventually look elsewhere.
We have been asking for years to either have a Pro version of Enfold that has more capabilities or the option of creating our own elements, but at this point, we are watching other frameworks grow by leaps and bounds while Enfold is still limited to only what you want to build into it. We love Enfold, and promote it every single chance we can, but the arguments that we used to have that Enfold had so much more and was so much easier are getting less and less compared to other frameworks. We want you back on top. Please.
I know I am pushing you, but it is only because we want to see Enfold do incredible things again.
November 29, 2019 at 10:21 am #1161161Hi,
Thank you for the motivation.
There is no interface available to create new elements for the builder, but your developer should be able to recognize the pattern in the shortcode files and will be able to come up with new elements in no time. All of the elements or shortcodes that you see in the builder lives inside the enfold > config-templatebuilder > aviashortcodes folder, and looking at two or more files will give you an idea on how an element’s options are created and how the element actually displays in the front end. And in order to add new shortcodes or elements in the child theme, you have to create a new path as described in the following documentation.
// https://kriesi.at/documentation/enfold/intro-to-layout-builder/#add-elements-to-alb
We know this is not that easy if you don’t have prior coding experience, but as of this moment, it is the only way to create new elements in the builder.
There is a user who are creating custom elements using the same steps describe above — in case you want to check it.
// https://kriesi.at/support/topic/custom-advanced-layout-builder-elements/page/6/#post-1137734
Best regards,
IsmaelJuly 21, 2020 at 1:59 pm #1232027I did some thinking about conditional elements and I could really use them as well.
My thought would be to add a filter field to enter a filter name into the developer settings on the advanced tab.
Then when processing elements would fire the filter which would return a boolean value to true or false (meaning include or not include this element).
By doing this, it’s completely independent of any usage and is general enough to included into the enfold base.
Is this something you would consider adding?
July 21, 2020 at 3:54 pm #1232039What I did for now was to use the avf_in_shortcode_handler_prepare_content filter and using the Custom ID field and if you set id to be peernetCan it will hide the element.
add_filter( ‘avf_in_shortcode_handler_prepare_content’, array( &$this,’enfold_shortcode_handler_prepare_content’), 10, 1 );
public function enfold_shortcode_handler_prepare_content( &$args )
{
// from wp-content\themes\enfold\config-templatebuilder\avia-template-builder\php\shortcode-template.class.php line 1064
//$args = array( $out, $this, $atts, $content, $shortcodename, $fake )$attrs = $args[2] ;
if ( !empty( $attrs[‘id’] ) ) {
if ( strpos($attrs[‘id’], “peernetCan”) === 0) {
$args[0] = ” ;}
}
return $args;
}
I’m looking to have is common development field like custom id that can be used in a similar manner to determine if an element is to be included or excluded.
For now I’ll go with this approach.
July 27, 2020 at 12:20 pm #1233494Hi,
Thank you for the info.
Using the avf_in_shortcode_handler_prepare_content filter should be sufficient enough to hook into the builder elements and add your own conditions based on the shortcode attributes before finally sending them to the template.
If you have further inquiries, please feel free to open a new thread.
Have a nice day.
Best regards,
Ismael -
AuthorPosts
- The topic ‘Conditional Ava Elements’ is closed to new replies.