Viewing 10 posts - 31 through 40 (of 40 total)
  • Posted in: Uplift
  • #294249
    David Martin – Support
    Moderator
    Post count: 20834

    Great, will update there.

    #301568
    WEswift
    Member
    Post count: 234

    Ed – I’m attempting to implement this code as a fallback for the other method (discussed here: http://www.swiftideas.com/forums/topic/additional-nucleo-icons/#post-301515) which isn’t yet working either. With your code as-is, I was able to get the icons to appear (as outlined down arrows) in the svg list. However, the icons did not appear on the front end. There is just an empty space.

    Update: I noticed your code utilized spb_outline_svg_icons, but i’m adding colored icons, so I swapped that bit with spb_coloured_svg_icons – which isn’t adding anything to the icon list. Thoughts?

    #301798
    David Martin – Support
    Moderator
    Post count: 20834

    Did you use the updated code?

    	/* 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' );
        }
    #301854
    WEswift
    Member
    Post count: 234

    David – I just added the following line:

    if ( !$svg_icons )
    {
         $svg_icons = array();
    }

    Unfortunately I still get the word “Array” in the svg icon list.

    Here’s my entire function:

    
    /* 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' );
        }

    Thoughts?

    #302232
    David Martin – Support
    Moderator
    Post count: 20834

    @WEswift Can you add your FTP details and a WP login.

    – David.

    #302251
    WEswift
    Member
    Post count: 234
    This reply has been marked as private.
    #302698
    David Martin – Support
    Moderator
    Post count: 20834

    Thanks for your patience, I have been looking into this but will need to check with Ed also this am.

    – David.

    #302784
    WEswift
    Member
    Post count: 234

    David – thanks for keeping this going. It’s much appreciated. Keep us posted. -Paul

    #302786
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    No problem. Let’s wait for Ed reply.

    -Rui

    #302894
    Swift Ideas – Ed
    Keymaster
    Post count: 15264

    Please try this code, it’s modified and tested on Uplift:

    /* 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

Viewing 10 posts - 31 through 40 (of 40 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