Created
April 19, 2018 23:24
-
-
Save chrisaldrich/3fb9b4ef6a4404675445cd3191ee4fe0 to your computer and use it in GitHub Desktop.
Template for the follow kind for Post Kinds Plugin for WordPress
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
<?php | |
/* | |
* Follow Template | |
* | |
*/ | |
$mf2_post = new MF2_Post( get_the_ID() ); | |
$cite = $mf2_post->fetch(); | |
if ( ! $cite ) { | |
return; | |
} | |
$author = Kind_View::get_hcard( ifset( $cite['author'] ) ); | |
$url = ifset( $cite['url'] ); | |
$embed = self::get_embed( $url ); | |
?> | |
<section class="response u-follow-of h-cite"> | |
<header> | |
<?php | |
echo Kind_Taxonomy::get_before_kind( 'follow' ); | |
if ( ! $embed ) { | |
if ( ! array_key_exists( 'name', $cite ) ) { | |
$cite['name'] = self::get_post_type_string( $url ); | |
} | |
if ( isset( $url ) ) { | |
echo sprintf( '<a href="%1s" class="p-name u-url">%2s</a>', $url, $cite['name'] ); | |
} else { | |
echo sprintf( '<span class="p-name">%1s</span>', $cite['name'] ); | |
} | |
if ( $author ) { | |
echo ' ' . __( 'by', 'indieweb-post-kinds' ) . ' ' . $author; | |
} | |
if ( array_key_exists( 'publication', $cite ) ) { | |
echo sprintf( ' <em>(<span class="p-publication">%1s</span>)</em>', $cite['publication'] ); | |
} | |
} | |
?> | |
</header> | |
<?php | |
if ( $cite ) { | |
if ( $embed ) { | |
echo sprintf( '<blockquote class="e-summary">%1s</blockquote>', $embed ); | |
} elseif ( array_key_exists( 'summary', $cite ) ) { | |
echo sprintf( '<blockquote class="e-summary">%1s</blockquote>', $cite['summary'] ); | |
} | |
} | |
// Close Response | |
?> | |
</section> | |
<?php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment