Skip to content

Instantly share code, notes, and snippets.

@miklb
Created April 24, 2017 22:22
Show Gist options
  • Save miklb/f86ece1431283f1220e2735449678724 to your computer and use it in GitHub Desktop.
Save miklb/f86ece1431283f1220e2735449678724 to your computer and use it in GitHub Desktop.
<?php
// Get the global `$wp_query` object.
$id = get_the_ID();
// Get the semantic_linkbacks_type 'like'.
$comments = get_linkbacks( 'like', $id );
?>
<section class="section">
<div class="container">
<ul class="pile likes">
<li class="icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 100 100.01" enable-background="new 0 0 100 100.01" xml:space="preserve"><g><path d="M68.422,12.527c1.141,0,2.342,0.058,3.639,0.187c7.86,0.763,16.963,7.97,18.068,21.771v4.59 c-1.031,13.214-11.003,29.501-40.148,49.939c-29.14-20.438-39.11-36.727-40.137-49.939v-4.59 c1.105-13.801,10.202-21.008,18.069-21.771c1.291-0.129,2.504-0.187,3.638-0.187c9.085,0,13.444,3.926,18.43,9.875 C54.973,16.453,59.337,12.527,68.422,12.527"></path></g></svg>
</li>
<?php
// Comment Loop.
if ( $comments ) {
foreach ( $comments as $comment ) {
?>
<li>
<?php $author_url = get_comment_meta( $comment->comment_ID, 'semantic_linkbacks_author_url', true ); ?>
<!-- TODO: get author name as alt for image -->
<a href="<?php echo $author_url ?>">
<?php $author_img = get_comment_meta( $comment->comment_ID, 'semantic_linkbacks_avatar', true ); ?>
<figure class="image is-64x64">
<img src="<?php echo $author_img ?>" alt="<?php echo $comment->comment_author; ?>">
</figure>
</a>
</li>
<?php
}
} else {
echo '<li>No likes.</li>';
}
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment