Within your child theme functions.php
file, paste this:
/* 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' );
}
Add your .SVG
files to the child theme folder /swift-builder-icons/svg/
.