-
AuthorPosts
-
January 11, 2023 at 12:12 pm #1378248
Hey Guys,
We are a little team, which are using your nice theme and Pagebuilder.Sometimes we need to register new Custom blocks and are doing this with custom HTML + CSS, which is not very userfriendly for the end user.
Do u have any reference code, on how we can register and create a custom block? Even better, a boilerplate plugin or code, which we can look at and customize?
January 12, 2023 at 8:26 am #1378351Hey BenjaminSpeedtsberg,
Thank you for the inquiry.
The code for the builder elements or shortcodes is located in the enfold\config-templatebuilder\avia-shortcodes folder. You can create a folder called “shortcodes” in your child theme and copy one of the shortcode files inside that folder to override an existing element or use it as a boilerplate to create another element or shortcode. Add this code in the functions.php file to register the folder “shortcodes” as a new shortcode or element path.
add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1); function avia_include_shortcode_template($paths) { $template_url = get_stylesheet_directory(); array_unshift($paths, $template_url.'/shortcodes/'); return $paths; }
// https://kriesi.at/documentation/enfold/intro-to-layout-builder/#add-elements-to-alb
Best regards,
IsmaelApril 20, 2023 at 6:42 pm #1405067Hey Again,
I am looking, for something like following code, can u asist how I can make my own custom component to the libary?
function my_enfold_custom_component() {
avia_builder_map( array(
‘name’ => ‘My Custom Component’,
‘base’ => ‘my_custom_component’,
‘category’ => ‘content’,
‘icon’ => ‘avia_bell’,
‘params’ => array(
array(
‘type’ => ‘textfield’,
‘heading’ => ‘Title’,
‘param_name’ => ‘title’,
‘value’ => ”,
‘description’ => ‘Enter a title for your custom component’,
‘admin_label’ => true,
),
// Add more parameters as needed
),
) );
}
add_action( ‘avia_builder_before_register_elements’, ‘my_enfold_custom_component’ );April 21, 2023 at 6:23 am #1405130Hi,
There are no available filters or hooks to allow you to register a new component or builder element. As instructed previously, you will need to create a new folder and include the necessary template files to add a new element to the builder.
To accomplish this, you should first add the avia_load_shortcodes filter in the functions.php file and create a folder called “shortcodes” in your child theme’s directory where you can store your custom builder element. Within this folder, you will need to create the required template files that will define the behavior and appearance of your new builder element.
As a starting point, you can just copy any of the existing builder element templates in the enfold/config-templatebuilder/avia-shortcodes folder and do the modifications as required.
Best regards,
IsmaelApril 21, 2023 at 7:27 am #1405133Hi Ismael,
Thanks for your reply!
We found a solutions, that gives us the possibility to extend avia layout builder with new components.
April 22, 2023 at 11:46 am #1405221 -
AuthorPosts
- You must be logged in to reply to this topic.