Support » Plugin: Menu Social Icons » Multiple added icons

  • Resolved jenp99

    (@jenp99)


    Awesome plugin – love it! Small issue…I am trying to add multiple icons from fontawesomes I have followed the plug in instructions below.

    How do I add multiple icons? I have tried and it crashed my site! I have added the “RSS” feed per below (which is fine) but when I do the same for “Podcast” it crashes the site.

    Thanks

    add_filter( ‘storm_social_icons_networks’, ‘storm_social_icons_networks’);
    function storm_social_icons_networks( $networks ) {

    $extra_icons = array (
    ‘/feed’ => array( // Enable this icon for any URL containing this text
    ‘name’ => ‘RSS’, // Default menu item label
    ‘class’ => ‘rss’, // Custom class
    ‘icon’ => ‘icon-rss’, // FontAwesome class
    ‘icon-sign’ => ‘icon-rss-sign’ // May not be available. Check FontAwesome.
    ),
    );

    $extra_icons = array_merge( $networks, $extra_icons );
    return $extra_icons;

    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Paul Clark

    (@pdclark)

    PHP crashes if you try to define two functions with the same name.

    For multiple extra icon definitions, append more items to the array:

    
    add_filter( 'storm_social_icons_networks', 'storm_social_icons_networks');
    function storm_social_icons_networks( $networks ) {
    
        $extra_icons = array (
            // One Icon
            '/feed' => array(                  // Enable this icon for any URL containing this text
                'name' => 'RSS',               // Default menu item label
                'class' => 'rss',              // Custom class
                'icon' => 'icon-rss',          // FontAwesome class
                'icon-sign' => 'icon-rss-sign' // May not be available. Check FontAwesome.
            ),
            // another icon
            '/url' => array(                  // Enable this icon for any URL containing this text
                'name' => 'Name',               // Default menu item label
                'class' => 'classsssss',              // Custom class
                'icon' => 'icon-classsssss',          // FontAwesome class
                'icon-sign' => 'icon-classsssss-sign' // May not be available. Check FontAwesome.
            ),
        );
    
        $extra_icons = array_merge( $networks, $extra_icons );
        return $extra_icons;
    
    }
    

    Ok thank you! I thought I had tried this in my list of guesses but it hasn’t crashed this time so perhaps not.

    The podcast icon isn’t appearing. I suspect from reading the developer information it may be because it’s an earlier version of the fontawesome icons?

    I have added the additional code to the file and it still isn’t working. Do I need to download or update the library to see the podcast icon?

    The code I have in the themes custom.php file is:

    add_filter( ‘storm_social_icons_use_latest’, ‘__return_true’ );

    add_filter( ‘storm_social_icons_networks’, ‘storm_social_icons_networks’);
    function storm_social_icons_networks( $networks ) {

    $extra_icons = array (
    ‘/feed’ => array( // Enable this icon for any URL containing this text
    ‘name’ => ‘RSS’, // Default menu item label
    ‘class’ => ‘rss’, // Custom class
    ‘icon’ => ‘icon-rss’, // FontAwesome class
    ‘icon-sign’ => ‘icon-rss-sign’ // May not be available. Check FontAwesome.
    ),
    ‘/podcast’ => array( // Enable this icon for any URL containing this text
    ‘name’ => ‘PODCAST’, // Default menu item label
    ‘class’ => ‘podcast’, // Custom class
    ‘icon’ => ‘icon-podcast’, // FontAwesome class
    ‘icon-sign’ => ‘icon-podcast-sign’ // May not be available. Check FontAwesome.
    ),
    );

    $extra_icons = array_merge( $networks, $extra_icons );
    return $extra_icons;

    }

    Sorted this but the update of icons? @pdclark

    Plugin Author Paul Clark

    (@pdclark)

    Yes, see the readme.
    There’s a filter for switching to the latest Font Awesome version.

    Here’s the filter in the readme and its use in code.

    Here’s the line the filter affects.

    • This reply was modified 2 years, 8 months ago by Paul Clark.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Multiple added icons’ is closed to new replies.