Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Uplift › Additional Nucleo Icons
New Landing › How can we help? › Themeforest Theme Support › Uplift › Additional Nucleo Icons
- This topic has 27 replies, 6 voices, and was last updated 7 years by Swift Ideas – Ed.
-
Posted in: Uplift
-
September 23, 2016 at 5:59 am #293062
I own the Nucleo family and was wondering if there is a way I could add more icons to be available in the Page Builder? Would save me a bunch of time. Thanks for your help. Ben
September 26, 2016 at 11:40 am #293306Hi Ben,
This is an option currently being worked on, planned for a big improved update. There is a related thread for this:
http://www.swiftideas.com/forums/topic/updating-svg-icons/page/2/.
Thanks.
November 10, 2016 at 11:43 pm #301433I would love to be able to do this as well. Any progress on this?
November 11, 2016 at 9:05 am #301447Hi,
Will forward to the development team to see if there is any update on this.
-Rui
November 11, 2016 at 1:59 pm #301515Hi there,
This is already implemented, simply use this folder structure in your child theme, with the svg icons within:
Hope that helps.
– Ed
November 11, 2016 at 4:12 pm #301552I’m not able to get this to work. I thought it was, but it was actually the fact that I had some duplicate svgs that were also already in the theme. Thoughts?
November 11, 2016 at 4:20 pm #301553Specifically, I’m trying to find the new icons within the Icon Box svg listing. Is there a different way I’m supposed to add these to content? Or should they appear in this and other pre-created svg lists for Swift Builder Elements?
November 11, 2016 at 6:05 pm #301575Apologies, forgot that you’ll also need this code in your child theme functions.php file:
/* ADD PAGE BUILDER SVG ICONS ================================================== */ if ( !function_exists( 'spb_child_theme_svg_icons' ) ) { function spb_child_theme_svg_icons( $svg_icons ) { // Check if we can access files if ( !function_exists('glob') ) { return $svg_icons; } // Path to directory to scan $folder = '/swift-builder-icons/svg/'; $directory = get_stylesheet_directory() . $folder; $uri = get_stylesheet_directory_uri() . $folder; // Get all svg files $svgs = glob($directory . "*.svg"); // If no files, return if ( empty($svgs) ) { return; } // Add each icon to array foreach($svgs as $svg) { $svg = basename($svg); $key = $uri . $svg; if ( !array_key_exists( $key, $svg_icons ) ) { $svg_icons[ $key ] = $svg; } } // Return array return $svg_icons; } add_filter( 'spb_svg_icons_list', 'spb_child_theme_svg_icons' ); }
– Ed
November 11, 2016 at 7:13 pm #301589Ed – Thanks for the swift response. Unfortunately, now the word “Array” appears in the svg list. Thoughts?
November 12, 2016 at 3:04 am #301620Sorry, the code should be:
/* ADD PAGE BUILDER SVG ICONS ================================================== */ if ( !function_exists( 'spb_child_theme_svg_icons' ) ) { function spb_child_theme_svg_icons( $svg_icons ) { if ( !$svg_icons ) { $svg_icons = array(); } // Check if we can access files if ( !function_exists('glob') ) { return $svg_icons; } // Path to directory to scan $folder = '/swift-builder-icons/svg/'; $directory = get_stylesheet_directory() . $folder; $uri = get_stylesheet_directory_uri() . $folder; // Get all svg files $svgs = glob($directory . "*.svg"); // If no files, return if ( empty($svgs) ) { return; } // Add each icon to array foreach($svgs as $svg) { $svg = basename($svg); $key = $uri . $svg; if ( !array_key_exists( $key, $svg_icons ) ) { $svg_icons[ $key ] = $svg; } } // Return array return $svg_icons; } add_filter( 'spb_svg_icons_list', 'spb_child_theme_svg_icons' ); }
Just tested locally and it worked fine for me – are you adding svg files to that folder?
– Ed
November 19, 2016 at 4:28 pm #302609I followed the instructions above and could not get this to work. The svg files inside the svg directory use the following naming convention:
sport-48px-outline_trophy.svg
tech-48px-outline-2_p-check.svgThe original parent theme svg files are still appearing in the Swift Builder.
Any assistance would be greatly appreciated.
November 20, 2016 at 4:05 pm #302647After double-checking, the word “Array” appears in the svg list as mentioned by WEswift. However, I’m using your second code block above not the first that WEswift reported earlier.
November 21, 2016 at 2:57 am #302662Hi @BillO
Any chance you could provide those files for us to try locally? Also, are you able to view those svg files in your browser window when visiting the live file link?
– Ed
November 22, 2016 at 2:03 am #302915This reply has been marked as private.November 22, 2016 at 2:58 am #302917I adjusted the code, and this should work now!
/* ADD PAGE BUILDER SVG ICONS ================================================== */ if ( !function_exists( 'spb_child_theme_svg_icons' ) ) { function spb_child_theme_svg_icons( $svg_icons ) { if ( !$svg_icons ) { $svg_icons = array(); } // Check if we can access files if ( !function_exists('glob') ) { return $svg_icons; } // Path to directory to scan $folder = '/swift-builder-icons/svg/'; $directory = get_stylesheet_directory() . $folder; $uri = get_stylesheet_directory_uri() . $folder; // Get all svg files $svgs = glob($directory . "*.svg"); // If no files, return if ( empty($svgs) ) { return; } // Add each icon to array foreach($svgs as $svg) { $svg = basename($svg); $key = $uri . $svg; if ( !array_key_exists( $key, $svg_icons ) ) { $svg_icons[ $key ] = $svg; } } // Output $svg_icon_output = ""; foreach ( $svg_icons as $icon => $name ) { $svg_icon_output .= '<li class="svg-icon" data-icon="'.$name.'" data-path="'.$icon.'"><i class="svg-icon-picker-item" style="background-image: url('.$icon.');"></i></li>'; } return $svg_icon_output; } add_filter( 'spb_svg_icons_list', 'spb_child_theme_svg_icons' ); }
– Ed
-
Posted in: Uplift
You must be logged in and have valid license to reply to this topic.