Skip to content

Instantly share code, notes, and snippets.

@joedolson
Created May 23, 2015 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joedolson/15da3c0ff349c7074534 to your computer and use it in GitHub Desktop.
Save joedolson/15da3c0ff349c7074534 to your computer and use it in GitHub Desktop.
For the purposes of styling, we take another look at the function created in Demo 4. We need some more complexity to style this effectively.
/*
* Generate the HTML links using URLs.
*
* @param integer $post_ID of current post
*
* @return string block of HTML links.
*/
function id24_create_links( $post_ID ) {
$urls = id24_create_urls( $post_ID );
$html = '';
foreach ( $urls as $service => $url ) {
if ( $url ) {
$html .= "
<div class='id24-link $service'>
<a href='" . esc_url( $url ) . "' rel='nofollow external' aria-describedby='description-$service'>
<span class='id24-icon $service' aria-hidden='true'></span>
<span class='id24-text $service'>" . ucfirst( $service ) . "</span>
</a>
<span class='description' role='tooltip' id='description-$service'>
" . __( 'Share this post' ) . "
</span>
</div>";
}
}
return "<div class='id24-links'>" . $html . "</div>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment