This adds triple tags for audio posts. The file is indieweb-post-kinds/views/kind-listen.php. For this to work, you should have some tags available in the Tags section for your Post Kind metadata.
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 | |
/* | |
Listen 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'] ); | |
$site_name = Kind_View::get_site_name( $cite, $url ); | |
$title = Kind_View::get_cite_title( $cite, $url ); | |
$embed = self::get_embed( $url ); | |
$duration = $mf2_post->get( 'duration', true ); | |
if ( ! $duration ) { | |
$duration = calculate_duration( $mf2_post->get( 'dt-start' ), $mf2_post->get( 'dt-end' ) ); | |
} | |
?> | |
<section class="response u-listen-of h-cite"> | |
<header> | |
<?php | |
echo Kind_Taxonomy::get_before_kind( 'listen' ); | |
if ( ! $embed ) { | |
if ( $title ) { | |
echo $title; | |
} | |
if ( $author ) { | |
echo ' ' . __( 'by', 'indieweb-post-kinds' ) . ' ' . $author; | |
} | |
if ( $site_name ) { | |
echo __( ' from ', 'indieweb-post-kinds' ) . '<em>' . $site_name . '</em>'; | |
} | |
if ( $duration ) { | |
echo '(<data class="p-duration" value="' . $duration . '">' . Kind_View::display_duration( $duration ) . '</data>)'; | |
} | |
} | |
?> | |
</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'] ); | |
} | |
} | |
if ( isset( $_POST['cite_tags'] ) ) { | |
$cite['category'] = array_filter( explode( ';', $_POST['cite_tags'] ) ); | |
} | |
echo '<footer><p>Machine tags for this post: <br />'; | |
echo sprintf ( '<small><span class="machinetags">%1s</span></small></p></footer>', implode (", ",$cite['category']) ); | |
// Close Response | |
?> | |
</section> | |
<?php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment