Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Genesis Simple Share Shortcode
<?php
// Adds a [social-icons] shortcode to output Genesis Simple Share icons in posts
// https://wordpress.org/plugins/genesis-simple-share/
// Add the code below to your active theme's functions.php file,
// or use in a site-specific plugin.
// The shortcode takes no attributes; change your icon settings via Genesis → Simple Share.
add_shortcode( 'social-icons', 'gss_shortcode' );
function gss_shortcode() {
global $genesis_simple_share;
$icons = '';
if ( function_exists( 'genesis_share_get_icon_output' ) ) {
$location = uniqid( 'gss-shortcode-' );
$icons = genesis_share_get_icon_output( $location, $genesis_simple_share->icons );
}
return $icons;
}
@dortzur
Copy link

dortzur commented Jan 10, 2016

Sweet!

@tomlefthook
Copy link

tomlefthook commented Jan 16, 2017

Thanks for this. I noticed that the shortcode won't fire more than once per page. Any adjustment possible to allow more shares? Thanks!

@nickcernis
Copy link
Author

nickcernis commented Jan 17, 2017

@lefthookdigitaltom I made an edit to allow it to be used multiple times per page. (It now generates a random location name for each instance.)

@Luisoncm
Copy link

Luisoncm commented Jan 26, 2018

This is great! just What i was looking for. Thanks million!

@ADAPTiveBen
Copy link

ADAPTiveBen commented Jan 23, 2020

Just to let you know that the $Genesis_Simple_Share variable name has been updated to $genesis_simple_share (lower case). Using the capitalised version will no longer work.

@nickcernis
Copy link
Author

nickcernis commented Jan 23, 2020

@ADAPTiveBen Thank you — this has been corrected above.

@KramarzGIT
Copy link

KramarzGIT commented Apr 16, 2020

I have tried to use this to shows icons on wigetized home page.. they don't show... source code shows them there but there's no visual output.
Any ideas?

@ananich
Copy link

ananich commented Sep 6, 2020

@KramazGIT, it seems that it will only work if you are using static home page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment