Issues when adding a new icon
-
I’m trying to add a custom icon for Strava to the Simple Social Icons. I have a relatively new install of WordPress 4.7, with Simple Social Icons v2.0.1.
I’m attempting to follow instructions as posted; here’s what I did:
(1) First I copy-pasted facebook.svg as strava.svg in the simple-social-icons/icons/SVG folder just so I would have a new SVG file. I then edited the new strava.svg XML to add the id and to match the Xml in the instructions so it now looks like this:
<svg width="100%" height="100%" viewBox="0 0 32 32" version="1.1" xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"> <defs> <symbol id="social-strava" viewBox="0 0 32 32"> <title>Strava</title> <path d="M23.738.214v4.714h-2.804c-1.023 0-1.714.214-2.071.643s-.536 1.071-.536 1.929v3.375h5.232l-.696 5.286h-4.536v13.554h-5.464V16.161H8.309v-5.286h4.554V6.982c0-2.214.62-3.932 1.857-5.152S17.607 0 19.666 0c1.75 0 3.107.071 4.071.214z"/> </symbol> </defs> </svg>
(2) Then, I added the following code to my functions.php:
//* Add Strava Simple Social Icons widget add_filter( 'simple_social_default_profiles', 'add_strava_simple_icon' ); function add_strava_simple_icon( $icons ) { $icons['strava-icon'] = [ 'label' => __( 'Strava URI', 'simple-social-icons' ), 'pattern' => '<li class="social-strava"><a href="%s" %s><svg role="img" class="social-strava-svg" aria-labelledby="social-strava"><title id="social-strava">' . __( 'Strava', 'simple-social-icons' ) . '</title><use xlink:href="' . esc_url( plugin_dir_url(__FILE__) . 'my.svg#social-strava' ) . '"></use></svg></a></li>', ]; return $icons; }
This seems to work partly, as I do see a new entry for Strava in the widget where I can enter the Strava URI, however, the image on the published website that shows up is plain black, and not the facebook SVG I copy-pasted. Is there another place where I need to upload/create an icon?
I am using the Genesis framework with the eleven40 theme. I have published the widget changes to my website to show the actual behavior.
Thanks
Ameya
- The topic ‘Issues when adding a new icon’ is closed to new replies.