Skip to content

Instantly share code, notes, and snippets.

@patric-boehner
Last active January 15, 2017 20:40
Show Gist options
  • Save patric-boehner/7c9cd399a213b650f123379fc77fdd9c to your computer and use it in GitHub Desktop.
Save patric-boehner/7c9cd399a213b650f123379fc77fdd9c to your computer and use it in GitHub Desktop.
Add an icon to Simple Social Icon
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Loading from a custom plugin
add_filter( 'simple_social_default_profiles', 'custom_add_new_simple_icon' );
function custom_add_new_simple_icon( $icons ) {
$icons['goodreads'] = [
'label' => __( 'Goodreads URI', 'simple-social-icons' ),
'pattern' => '<li class="social-goodreads"><a href="%s" %s><svg role="img" class="social-goodreads" aria-labelledby="social-goodreads"><title id="social-goodreads">' . __( 'Goodreads', 'simple-social-icons' ) . '</title><use xlink:href="' . esc_url( plugin_dir_url(__FILE__) . 'svg/goodreads.svg#social-goodreads' ) . '"></use></svg></a></li>',
];
return $icons;
}
//* Loading from a theme
add_filter( 'simple_social_default_profiles', 'custom_add_new_simple_icon' );
function custom_add_new_simple_icon( $icons ) {
$icons['goodreads'] = [
'label' => __( 'GoodReads URI', 'simple-social-icons' ),
'pattern' => '<li class="social-goodreads"><a href="%s" %s><svg role="img" class="social-goodreads" aria-labelledby="social-goodreads"><title id="social-goodreads">' . __( 'goodreads', 'simple-social-icons' ) . '</title><use xlink:href="' .esc_url( get_stylesheet_directory_uri() .'/svg/goodreads.svg#social-goodreads' ) . '"</use></svg></a></li>',
];
return $icons;
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment