Instantly share code, notes, and snippets.
Created
November 17, 2016 15:06
-
Star
2
(2)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save rdub80/978e90a9cf8a25b4455ac82b9532c22e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add Social Links Shortcode | |
function social_shortcode( $atts ) { | |
// Attributes | |
$atts = shortcode_atts( | |
array( | |
'twitter' => '', | |
'linkedin' => '', | |
'instagram' => '', | |
'pinterest' => '', | |
'snapchat' => '', | |
'youtube' => '', | |
'medium' => '', | |
'dribbble' => '', | |
'facebook' => '', | |
'spotify' => '', | |
'soundcloud' => '', | |
'github' => '', | |
'codepen' => '', | |
'flickr' => '', | |
), | |
$atts | |
); | |
$tw = $atts['twitter']; | |
$li = $atts['linkedin']; | |
$ig = $atts['instagram']; | |
$pn = $atts['pinterest']; | |
$sn = $atts['snapchat']; | |
$yt = $atts['youtube']; | |
$md = $atts['medium']; | |
$db = $atts['dribbble']; | |
$fb = $atts['facebook']; | |
$sp = $atts['spotify']; | |
$sc = $atts['soundcloud']; | |
$gh = $atts['github']; | |
$cp = $atts['codepen']; | |
$fl = $atts['flickr']; | |
if($tw != ''){ | |
$tw = '<li><a class="twitter" href="' . esc_attr($atts['twitter']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="twitter"><title id="twitter">Twitter</title><path id="icntwitter" fill="#FFFFFF" d="M25.284,11.305c-0.177,8.058-5.256,13.662-12.963,14.013c-3.152,0.176-5.43-0.875-7.531-2.102c2.277,0.351,5.254-0.525,6.831-1.927c-2.277-0.175-3.679-1.401-4.379-3.327c0.7,0.174,1.401,0,1.927,0c-2.102-0.701-3.504-1.928-3.679-4.73c0.525,0.35,1.227,0.525,1.928,0.525C5.841,12.881,4.79,9.553,6.016,7.451c2.277,2.452,5.08,4.554,9.634,4.904c-1.227-4.904,5.43-7.532,8.059-4.203c1.225-0.176,2.101-0.701,2.978-1.051c-0.352,1.226-1.052,1.927-1.928,2.627c0.876-0.175,1.751-0.35,2.452-0.701C27.035,9.903,26.159,10.604,25.284,11.305z"/></svg></a></li>'; | |
} | |
if($li != ''){ | |
$li = '<li><a class="linkedin" href="' . esc_attr($atts['linkedin']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="linkedin"><title id="linkedin">Linkedin</title><g id="icnlinkedin"><rect x="6.889" y="12.897" fill="#FFFFFF" width="4.01" height="11.981"/><path fill="#FFFFFF" d="M8.919,7.121c-1.372,0-2.269,0.896-2.269,2.069c0,1.151,0.872,2.071,2.216,2.071h0.026c1.397,0,2.268-0.92,2.268-2.071C11.134,8.016,10.29,7.121,8.919,7.121z"/><path fill="#FFFFFF" d="M20.732,12.615c-2.128,0-3.077,1.165-3.61,1.98v-1.698h-4.008c0.054,1.124,0,11.981,0,11.981h4.008v-6.692c0-0.357,0.027-0.714,0.135-0.97c0.287-0.717,0.946-1.458,2.056-1.458c1.449,0,2.029,1.1,2.029,2.71v6.41h4.008V18.01C25.35,14.327,23.372,12.615,20.732,12.615z M17.122,14.634h-0.025c0.006-0.011,0.017-0.024,0.025-0.038V14.634z"/></g></svg></a></li>'; | |
} | |
if($ig != ''){ | |
$ig = '<li><a class="instagram" href="' . esc_attr($atts['instagram']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="instagram"><title id="instagram">Instagram</title><g id="icninstagram"><path fill="#FFFFFF" d="M16,10.295c-3.146,0-5.705,2.56-5.705,5.705s2.56,5.705,5.705,5.705s5.705-2.56,5.705-5.705S19.146,10.295,16,10.295z M16,19.295c-1.816,0-3.295-1.479-3.295-3.295s1.479-3.294,3.295-3.294s3.294,1.478,3.294,3.294S17.816,19.295,16,19.295z"/><circle fill="#FFFFFF" cx="21.889" cy="10.125" r="1.35"/><path fill="#FFFFFF" d="M21.488,4.924H10.512c-3.081,0-5.588,2.507-5.588,5.588v10.977c0,3.081,2.507,5.588,5.588,5.588h10.977c3.081,0,5.588-2.507,5.588-5.588V10.512C27.076,7.431,24.569,4.924,21.488,4.924z M24.665,21.488c0,1.752-1.425,3.177-3.177,3.177H10.512c-1.751,0-3.177-1.425-3.177-3.177V10.512c0-1.751,1.426-3.177,3.177-3.177h10.977c1.752,0,3.177,1.426,3.177,3.177V21.488z"/></g></svg></a></li>'; | |
} | |
if($pn != ''){ | |
$pn = '<li><a class="pinterest" href="' . esc_attr($atts['pinterest']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="pinterest"><title id="pinterest">Pinterest</title><path id="icnpinterest" fill="#FFFFFF" d="M17.961,20.911c-1.376,0-2.67-0.739-3.11-1.587c0,0-0.739,2.933-0.894,3.502c-0.552,2-2.176,4-2.299,4.161c-0.086,0.116-0.282,0.078-0.305-0.071c-0.033-0.258-0.448-2.778,0.039-4.834c0.244-1.034,1.637-6.937,1.637-6.937s-0.406-0.812-0.406-2.013c0-1.889,1.094-3.296,2.457-3.296c1.159,0,1.715,0.868,1.715,1.911c0,1.162-0.74,2.906-1.123,4.517c-0.318,1.351,0.674,2.45,2.007,2.45c2.415,0,4.035-3.095,4.035-6.762c0-2.791-1.876-4.88-5.296-4.88c-3.858,0-6.264,2.88-6.264,6.094c0,1.111,0.328,1.895,0.841,2.496c0.235,0.283,0.265,0.394,0.184,0.714c-0.064,0.235-0.201,0.796-0.265,1.022c-0.081,0.32-0.347,0.436-0.637,0.315c-1.773-0.726-2.603-2.671-2.603-4.864c0-3.614,3.042-7.948,9.094-7.948c4.86,0,8.057,3.518,8.057,7.291C24.825,17.184,22.052,20.911,17.961,20.911z"/></svg></a></li>'; | |
} | |
if($sn != ''){ | |
$sn = '<li><a class="snapchat" href="' . esc_attr($atts['snapchat']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="snapchat"><title id="snapchat">Snapchat</title><path id="icnsnapchat" fill="#FFFFFF" d="M26.494,21.124c-2.77-0.456-4.031-3.258-4.166-3.576c-0.003-0.006-0.014-0.027-0.017-0.034c-0.139-0.283-0.174-0.512-0.101-0.681c0.146-0.343,0.762-0.539,1.156-0.664c0.111-0.036,0.215-0.068,0.298-0.101c0.799-0.315,1.198-0.718,1.19-1.198c-0.009-0.381-0.306-0.73-0.749-0.887c-0.152-0.063-0.334-0.099-0.511-0.099c-0.121,0-0.303,0.018-0.477,0.099c-0.337,0.158-0.638,0.243-0.864,0.252c-0.102-0.004-0.179-0.021-0.233-0.04c0.007-0.12,0.015-0.243,0.022-0.369l0.004-0.064c0.095-1.495,0.211-3.354-0.286-4.468c-1.471-3.299-4.594-3.555-5.516-3.555l-0.43,0.004c-0.92,0-4.037,0.256-5.507,3.553c-0.499,1.117-0.38,2.976-0.286,4.47c0.009,0.147,0.018,0.291,0.026,0.43c-0.063,0.021-0.153,0.041-0.277,0.041c-0.265,0-0.582-0.086-0.942-0.254c-0.521-0.244-1.472,0.082-1.601,0.758c-0.07,0.365,0.078,0.893,1.176,1.327c0.085,0.033,0.193,0.067,0.325,0.109c0.368,0.117,0.984,0.312,1.13,0.656c0.072,0.169,0.038,0.398-0.114,0.709c-0.055,0.127-1.359,3.096-4.241,3.571c-0.298,0.048-0.512,0.313-0.495,0.616c0.004,0.083,0.024,0.167,0.06,0.253c0.242,0.566,1.164,0.959,2.9,1.234c0.038,0.099,0.083,0.301,0.107,0.419c0.037,0.167,0.075,0.34,0.127,0.519c0.053,0.182,0.21,0.486,0.663,0.486c0.154,0,0.331-0.035,0.524-0.073c0.278-0.055,0.657-0.129,1.128-0.129c0.262,0,0.533,0.024,0.808,0.069c0.52,0.086,0.976,0.408,1.503,0.782c0.778,0.55,1.484,0.97,2.898,0.97c0.038,0,0.075-0.001,0.111-0.004c0.053,0.003,0.105,0.004,0.159,0.004c1.238,0,2.329-0.326,3.241-0.972c0.504-0.356,0.979-0.693,1.5-0.78c0.275-0.045,0.548-0.069,0.81-0.069c0.45,0,0.811,0.059,1.132,0.122c0.218,0.042,0.388,0.063,0.544,0.063c0.315,0,0.55-0.175,0.639-0.478c0.052-0.177,0.09-0.345,0.128-0.517c0.02-0.091,0.066-0.31,0.107-0.415c1.71-0.271,2.584-0.649,2.825-1.214c0.037-0.082,0.059-0.168,0.064-0.261C27.007,21.439,26.794,21.174,26.494,21.124z"/></svg></a></li>'; | |
} | |
if($yt != ''){ | |
$yt = '<li><a class="youtube" href="' . esc_attr($atts['youtube']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="youtube"><title id="youtube">YouTube</title><path id="icnyoutube" fill="#FFFFFF" d="M26.693,10.763c-0.271-1.179-1.234-2.048-2.395-2.177c-2.747-0.307-5.527-0.308-8.295-0.307c-2.769-0.001-5.551,0-8.297,0.307c-1.159,0.129-2.123,0.999-2.393,2.177C4.928,12.44,4.923,14.272,4.923,16c0,1.728,0,3.56,0.387,5.237c0.27,1.179,1.234,2.049,2.394,2.178c2.747,0.307,5.527,0.309,8.295,0.307c2.769,0.002,5.55,0,8.296-0.307c1.16-0.129,2.123-0.999,2.395-2.178c0.387-1.677,0.388-3.509,0.388-5.237C27.077,14.272,27.08,12.44,26.693,10.763z M13.142,19.439v-7.327c2.347,1.225,4.68,2.441,7.042,3.674C17.828,17.008,15.495,18.219,13.142,19.439z"/></svg></a></li>'; | |
} | |
if($md != ''){ | |
$md = '<li><a class="medium" href="' . esc_attr($atts['medium']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="medium"><title id="medium">Medium</title><g id="icnmedium"><path id="Fill-1" fill="#808080" d="M20.01,7.329c-0.314-0.157-0.572,0.002-0.572,0.354v13.991l5.734,2.871c0.631,0.314,1.141,0.095,1.141-0.494V10.578c0-0.056-0.031-0.108-0.082-0.133L20.01,7.329"/><path id="Fill-2" fill="#ACADAE" d="M12.563,18.231l6.541-10.644c0.184-0.3,0.592-0.416,0.906-0.259l6.229,3.119c0.041,0.021,0.055,0.071,0.031,0.11l-6.832,11.116L12.563,18.231"/><path id="Fill-3" fill="#D8D9D8" d="M6.639,7.52C6.115,7.257,5.938,7.452,6.245,7.951l6.318,10.28l6.875,3.442l-6.86-11.164c-0.011-0.016-0.023-0.028-0.04-0.037L6.639,7.52"/><path id="Fill-4" fill="#FFFFFF" d="M12.563,24.051c0,0.586-0.429,0.851-0.953,0.59L6.258,21.96c-0.314-0.157-0.571-0.573-0.571-0.925V7.896c0-0.469,0.343-0.681,0.762-0.471l6.077,3.043c0.022,0.011,0.037,0.034,0.037,0.06V24.051"/></g></svg></a></li>'; | |
} | |
if($db != ''){ | |
$db = '<li><a class="dribbble" href="' . esc_attr($atts['dribbble']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="dribbble"><title id="dribbble">Dribbble</title><path id="icndribbble" fill="#FFFFFF" d="M15.994,6.293c-5.374,0-9.743,4.369-9.743,9.743c0,5.375,4.369,9.755,9.743,9.755c5.375,0,9.755-4.38,9.755-9.755C25.749,10.662,21.369,6.293,15.994,6.293z M15.994,8.068c1.638,0,3.15,0.492,4.414,1.331c-0.969,1.334-2.154,2.424-3.496,3.254c-0.85-1.524-1.861-2.951-3.002-4.275C14.584,8.196,15.268,8.068,15.994,8.068z M12.187,9.08c1.212,1.34,2.259,2.812,3.142,4.378c-2.189,0.943-4.646,1.229-7.078,0.779C8.77,12.004,10.232,10.152,12.187,9.08z M8.025,16.036c0.822,0.113,1.652,0.217,2.475,0.217c1.963,0,3.877-0.432,5.643-1.211c0.225,0.467,0.424,0.926,0.614,1.411c-2.605,0.926-4.907,2.63-6.61,4.967C8.839,20,8.025,18.124,8.025,16.036z M15.994,24.017c-1.679,0-3.236-0.527-4.517-1.42c1.489-2.111,3.549-3.651,5.875-4.482c0.554,1.775,0.919,3.618,1.057,5.485C17.639,23.844,16.843,24.017,15.994,24.017z M17.719,14.229c1.548-0.926,2.924-2.164,4.049-3.668c1.314,1.391,2.145,3.251,2.189,5.304c-1.861-0.328-3.723-0.32-5.504,0.077C18.228,15.362,17.986,14.792,17.719,14.229z M20.106,22.84c-0.173-1.774-0.521-3.514-1.048-5.21c1.539-0.312,3.15-0.305,4.752,0.008C23.358,19.845,21.974,21.706,20.106,22.84z"/></svg></a></li>'; | |
} | |
if($fb != ''){ | |
$fb = '<li><a class="facebook" href="' . esc_attr($atts['facebook']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="facebook"><title id="facebook">Facebook</title><path id="icnfacebook" fill="#FFFFFF" d="M20.653,16.009h-3.045c0,4.865,0,10.853,0,10.853h-4.512c0,0,0-5.93,0-10.853h-2.145v-3.836h2.145v-2.48c0-1.777,0.845-4.554,4.553-4.554l3.344,0.013v3.724c0,0-2.031,0-2.426,0c-0.396,0-0.957,0.197-0.957,1.045v2.254h3.438L20.653,16.009z"/></svg></a></li>'; | |
} | |
if($sp != ''){ | |
$sp = '<li><a class="spotify" href="' . esc_attr($atts['spotify']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="spotify"><title id="spotify">Spotify</title><path id="icnspotify" fill="#FFFFFF" d="M16,4.924C9.883,4.924,4.923,9.882,4.923,16c0,6.117,4.96,11.076,11.077,11.076S27.077,22.117,27.077,16C27.077,9.882,22.117,4.924,16,4.924z M20.263,21.261c-0.179,0-0.302-0.062-0.468-0.164c-1.605-0.971-3.608-1.481-5.732-1.481c-1.185,0-2.378,0.152-3.494,0.384c-0.182,0.04-0.408,0.108-0.545,0.108c-0.422,0-0.701-0.332-0.701-0.695c0-0.465,0.268-0.697,0.602-0.762c1.369-0.312,2.732-0.49,4.146-0.49c2.424,0,4.584,0.557,6.441,1.672c0.277,0.16,0.439,0.326,0.439,0.736C20.951,20.969,20.627,21.261,20.263,21.261z M21.471,18.329c-0.241,0-0.393-0.097-0.556-0.192c-1.803-1.068-4.3-1.779-7.033-1.779c-1.403,0-2.614,0.197-3.616,0.463c-0.216,0.061-0.337,0.125-0.539,0.125c-0.476,0-0.865-0.389-0.865-0.869c0-0.471,0.229-0.795,0.689-0.925c1.245-0.343,2.517-0.606,4.367-0.606c2.9,0,5.705,0.723,7.91,2.042c0.369,0.212,0.506,0.481,0.506,0.876C22.334,17.941,21.951,18.329,21.471,18.329z M22.844,14.919c-0.225,0-0.358-0.056-0.57-0.171c-2.006-1.202-5.116-1.863-8.125-1.863c-1.502,0-3.027,0.153-4.424,0.532c-0.162,0.04-0.364,0.121-0.569,0.121c-0.591,0-1.044-0.468-1.044-1.059c0-0.602,0.373-0.939,0.775-1.058c1.58-0.465,3.341-0.682,5.258-0.682c3.252,0,6.675,0.669,9.174,2.137c0.336,0.191,0.57,0.479,0.57,1.006C23.889,14.486,23.402,14.919,22.844,14.919z"/></svg></a></li>'; | |
} | |
if($sc != ''){ | |
$sc = '<li><a class="soundcloud" href="' . esc_attr($atts['soundcloud']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="soundcloud"><title id="soundcloud">SoundCloud</title><path id="icnsoundcloud" fill="#FFFFFF" d="M10.226,21.103h1.525v-9.607c-0.572,0.162-1.087,0.455-1.525,0.841V21.103z M7.175,14.603v6.488l0.099,0.012h1.427v-6.509H7.273L7.175,14.603z M4.124,17.847c0,1.182,0.615,2.205,1.525,2.777v-5.552C4.739,15.642,4.124,16.667,4.124,17.847z M13.277,21.103h1.526v-9.184c-0.456-0.285-0.973-0.472-1.526-0.544V21.103z M25.383,14.593h-0.857c0.043-0.265,0.07-0.535,0.07-0.813c0-2.696-2.115-4.882-4.725-4.882c-1.416,0-2.678,0.652-3.543,1.672v10.532h9.055c1.739,0,3.149-1.457,3.149-3.256C28.532,16.049,27.122,14.593,25.383,14.593z"/></svg></a></li>'; | |
} | |
if($gh != ''){ | |
$gh = '<li><a class="github" href="' . esc_attr($atts['github']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="github"><title id="github">GitHub</title><path id="icngithub" fill="#FFFFFF" d="M21.33,7.118c0.303,0.684,0.498,1.82,0.207,2.652c1.191,1.017,1.6,3.488,1.025,5.507c1.697,0.13,3.719-0.062,5.023,0.459c-1.221-0.157-2.887-0.464-4.459-0.358c-0.299,0.021-0.74-0.011-0.719,0.409c1.822,0.143,3.631,0.298,5.127,0.765c-1.484-0.242-3.283-0.611-5.127-0.663c-0.762,1.502-2.293,2.241-4.408,2.396c0.227,0.494,0.664,0.683,0.768,1.479c0.16,1.189-0.248,2.93,0.154,3.723c0.193,0.38,0.508,0.39,0.719,0.715c-0.518,0.613-1.803-0.069-1.948-0.715c-0.251-1.105,0.382-2.819-0.307-3.569c0.048,1.206-0.286,2.899,0.052,3.978c0.132,0.424,0.514,0.587,0.409,0.969c-2.409,0.244-1.401-3.116-1.796-5.1c-0.363,0.025-0.204,0.544-0.206,0.766c-0.009,1.937,0.398,4.593-1.69,4.334c-0.062-0.407,0.28-0.545,0.411-0.917c0.38-1.089-0.072-2.714,0.103-4.029c-0.797,0.601,0.083,2.698-0.41,3.773c-0.285,0.619-1.201,0.889-1.896,0.612c0.091-0.461,0.566-0.387,0.768-0.816c0.282-0.599,0.002-1.46,0.103-2.345c-1.475,0.294-2.619-0.043-3.179-0.97c-0.25-0.416-0.313-0.907-0.616-1.275c-0.301-0.367-0.782-0.418-0.921-0.917c1.827-0.439,1.896,1.881,3.537,1.938c0.503,0.019,0.765-0.146,1.23-0.255c0.13-0.584,0.41-1.021,0.821-1.326c-2.042-0.279-3.728-0.915-4.512-2.447c-1.855,0.091-3.553,0.34-5.126,0.713c1.428-0.518,3.189-0.704,5.076-0.765c-0.112-0.668-1.087-0.485-1.692-0.46c-1.125,0.05-2.541,0.19-3.435,0.358c1.296-0.462,3.115-0.405,4.871-0.408c-0.537-1.684-0.352-4.359,0.82-5.355C9.773,9.138,9.876,7.77,10.311,7.118c1.307,0.059,2.1,0.629,2.922,1.173c1.019-0.29,2.09-0.434,3.486-0.357c0.586,0.033,1.197,0.296,1.641,0.255c0.432-0.041,0.91-0.527,1.332-0.713C20.24,7.233,20.705,7.141,21.33,7.118z"/></svg></a></li>'; | |
} | |
if($cp != ''){ | |
$cp = '<li><a class="codepen" href="' . esc_attr($atts['codepen']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="codepen"><title id="codepen">Codepen</title><path id="icncodepen" fill="#FFFFFF" d="M16.512,5.806c-0.565-0.375-1.304-0.366-1.862,0.022l-8.348,5.814c-0.444,0.311-0.71,0.818-0.71,1.361v6.264c0,0.557,0.279,1.076,0.744,1.383l8.484,5.609c0.555,0.367,1.274,0.367,1.83,0l8.65-5.717c0.467-0.307,0.746-0.826,0.746-1.384v-6.154c0-0.557-0.279-1.076-0.744-1.383L16.512,5.806z M22.977,12.591l-3.199,2.147l-2.998-2.181l-0.02-4.29L22.977,12.591z M14.59,8.271v4.199l-3.073,2.149l-3.065-2.056L14.59,8.271z M7.612,14.633l1.983,1.33L7.612,17.35V14.633z M14.643,23.583l-6.19-4.151l3.093-2.161l3.098,2.078V23.583L14.643,23.583z M13.467,15.927l2.004-1.402l2.333,1.535l-2.068,1.389L13.467,15.927z M16.828,23.583v-4.235l2.961-1.984l3.188,2.096L16.828,23.583z M23.859,17.421l-2.102-1.38l2.102-1.409V17.421z"/></svg></a></li>'; | |
} | |
if($fl != ''){ | |
$fl = '<li><a class="flickr" href="' . esc_attr($atts['flickr']) . '"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32" enable-background="new 0 0 32 32" xml:space="preserve" aria-labelledby="flickr"><title id="flickr">Codepen</title><g id="icnflickr" ><circle fill="#FFFFFF" cx="9.719" cy="16" r="5.148"/><circle fill="#FFFFFF" cx="22.281" cy="16" r="5.148"/></g></svg></a></li>'; | |
} | |
$icons = '<ul>' | |
. $tw | |
. $li | |
. $ig | |
. $pn | |
. $sn | |
. $yt | |
. $md | |
. $db | |
. $fb | |
. $sp | |
. $sc | |
. $gh | |
. $cp | |
. $fl | |
. '</ul>'; | |
return $icons; | |
} | |
add_shortcode( 'social', 'social_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Snippet allows for the following social links:
Input into WP content:
[social twitter="https://twitter.com/username" facebook="https://www.facebook.com/username" flickr="https://www.flickr.com/photos/username" instagram="https://instagram.com/username" pinterest="https://www.pinterest.com/username" spotify="https://play.spotify.com/user/12345678" dribbble="https://dribbble.com/username" medium="https://medium.com/@username" ]
is rendering as:
<ul><li><a class="twitter" href="https://twitter.com/username"><svg>...</svg></a></li>...<li><a class="medium" href="https://medium.com/@username"><svg>...</svg></a></li></ul>