New Landing How can we help? Themeforest Theme Support Dante Add new widget to the Builder

Viewing 13 posts - 1 through 13 (of 13 total)
  • Posted in: Dante
  • #209949
    vasikgreif
    Member
    Post count: 21

    Hi,
    for my client I need to create a new widget with a custom form. In Visual Composer I just use vc_map() function to add the new element to the builder – how are the new elements added to Swift Page Builder?

    Thanks
    Vasik

    #210025
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    Just create a text box and add the form, then you can save the asset by clicking the little save icon

    – Kyle

    #210028
    vasikgreif
    Member
    Post count: 21

    Hi,
    thanks for reply. My form is a pretty complex one, with lots of stuff from DB, Ajax etc., so pasting it into text field is NOT an option for sure. I added the new widget by copying one of the shortcodes from swift-framework/page-builder/builder/shortcodes . I need to know how to include the new shortcode from my child theme, to stay upgrade safe.

    Thanks
    Vasik

    #210320
    demonzmedia
    Member
    Post count: 1

    I also need to add a new widget to the page builder did anyone solve how to do this?

    #210362
    vasikgreif
    Member
    Post count: 21

    Come on guys, what makes a great theme is a great support, and this has to be easily doable – in child theme functions.php there’s even

    // OVERWRITE PAGE BUILDER ASSETS
    //	function spb_regsiter_assets() {
    //		require_once( get_stylesheet_directory_uri() . '/default.php' );
    //	}
    //	if (is_admin()) {
    //	add_action('admin_init', 'spb_regsiter_assets', 2);
    //	}
    //	if (!is_admin()) {
    //	add_action('wp', 'spb_regsiter_assets', 2);
    //	}
    

    so it’s just the matter of telling us how tu use this function…

    #210485
    vasikgreif
    Member
    Post count: 21

    OK, it was easy in fact:

    Create shortcodes directory in you child theme, copy some shortcode file from swift-framework/page-builder/builder/shortcodes (I took the icon-boxes.php),rename it to something like ‘my-new-shortcode.php’ and copy into your shortcodes folder. Replace all instances of spb_icon_box with my_prefix_my_new_shortcode.

    Than just include that file:

    
    	function my_prefix_register_assets() {
    		require_once( 'shortcodes/my-new-shortcode.php' );
    	}
    	if (is_admin()) {
    	add_action('admin_init', 'my_prefix_register_assets()', 2);
    	}
    	if (!is_admin()) {
    	add_action('wp', 'my_prefix_register_assets()', 2);
    	}
    
    #210791
    David Martin – Support
    Moderator
    Post count: 20834

    Hi vasikgreif,

    Thanks for documenting that, hopefully it will assist others also.

    Thanks,
    David.

    #210792
    David Martin – Support
    Moderator
    Post count: 20834

    As mentioned by @vasikgreif, within your child theme functions.php file, locate this and remove the comments // to activate it:

    // OVERWRITE PAGE BUILDER ASSETS
    // function spb_regsiter_assets() {
    // require_once( get_stylesheet_directory_uri() . '/default.php' );
    // }
    // if (is_admin()) {
    // add_action('admin_init', 'spb_regsiter_assets', 2);
    // }
    // if (!is_admin()) {
    // add_action('wp', 'spb_regsiter_assets', 2);
    // }

    The child theme comes packaged within your main zip file available from ThemeForest.

    – David.

    #211089
    vasikgreif
    Member
    Post count: 21

    Thanks David for the comment. It would make sense to either fix the typo in the function name spb_regsiter_assets(), or to rename it to something different, to not confuse developers. I mean, to // OVERWRITE PAGE BUILDER ASSETS would require to fix the typo, for adding a new element the function name can be whatever.

    Also, it might be a great idea to include some example of basic widget in the child theme (or at least in developers documentation), to make things a little bit easier for the developers.

    Last but not least, the documentation for page builder assets is out of date – the spb_register_assets() function loads the shortcodes automatically from the folder, instead of including them one by one..:) A fix for that would also be cool…

    #211389
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Thanks for your suggestion, will forward them to the development team.
    -Rui

    #211507
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Thanks for the heads up – will get that sorted.

    – Ed

    #211553
    vasikgreif
    Member
    Post count: 21

    Cool, thanks!

    #211915
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    great. Thanks Ed.
    -Rui

Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register