Created
April 20, 2018 02:20
-
-
Save chrisaldrich/07b365cd387391788ae6db97a26d23b1 to your computer and use it in GitHub Desktop.
View template 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 | |
/* | |
* Acquisition 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 h-product h-cite"> | |
<header> | |
<?php | |
echo Kind_Taxonomy::get_before_kind( 'acquisition' ); | |
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-brand">%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