Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Dante › Add new widget to the Builder
New Landing › How can we help? › Themeforest Theme Support › Dante › Add new widget to the Builder
- This topic has 12 replies, 6 voices, and was last updated 9 years by
Rui Guerreiro – SUPPORT.
-
Posted in: Dante
-
September 2, 2015 at 11:05 pm #209949
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
VasikSeptember 3, 2015 at 8:29 am #210025Hi
Just create a text box and add the form, then you can save the asset by clicking the little save icon
– Kyle
September 3, 2015 at 8:37 am #210028Hi,
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
VasikSeptember 4, 2015 at 6:00 am #210320I also need to add a new widget to the page builder did anyone solve how to do this?
September 4, 2015 at 9:14 am #210362Come 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…
September 4, 2015 at 3:20 pm #210485OK, it was easy in fact:
Create
shortcodes
directory in you child theme, copy some shortcode file fromswift-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 ofspb_icon_box
withmy_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); }
September 7, 2015 at 9:43 am #210791Hi vasikgreif,
Thanks for documenting that, hopefully it will assist others also.
Thanks,
David.September 7, 2015 at 9:45 am #210792As 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.
September 7, 2015 at 10:27 pm #211089Thanks 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…September 8, 2015 at 4:42 pm #211389Thanks for your suggestion, will forward them to the development team.
-RuiSeptember 9, 2015 at 12:10 am #211507Thanks for the heads up – will get that sorted.
– Ed
September 9, 2015 at 7:43 am #211553Cool, thanks!
September 10, 2015 at 10:09 am #211915great. Thanks Ed.
-Rui -
Posted in: Dante
You must be logged in and have valid license to reply to this topic.