Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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?

    #1378351

    Hey 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,
    Ismael

    #1405067

    Hey 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’ );

    #1405130

    Hi,

    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,
    Ismael

    #1405133

    Hi Ismael,

    Thanks for your reply!

    We found a solutions, that gives us the possibility to extend avia layout builder with new components.

    #1405221

    Hi,

    Thanks for the update. Please let us know if you should need any further help on the topic.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.