Skip to content

Instantly share code, notes, and snippets.

@chrisbergr
Created September 22, 2019 16:57
Show Gist options
  • Save chrisbergr/ed92aea9ed0767a8b9cee93e16fe9fce to your computer and use it in GitHub Desktop.
Save chrisbergr/ed92aea9ed0767a8b9cee93e16fe9fce to your computer and use it in GitHub Desktop.
Post Kinds suggestions
.svg-icon svg{fill:currentColor;padding:2px;vertical-align:middle;top:-0.0625em}#kind-all svg{width:1rem;height:1rem;color:grey}#kind-menu svg,#kind-posts svg{width:1.5rem;height:1.5rem;color:#000}#kind-menu ul,#kind-posts ul{list-style-type:none}.response svg{width:2rem;height:2rem;color:#000}.response{margin-bottom:10px;margin-top:10px;margin-left:20px;padding:5px;font-size:16px;border-bottom:inset #D6D6D6}.response .kind-icon{margin-right:3px}.response blockquote{margin-left:25px}.response a:link{text-decoration:none}.response a:hover{text-decoration:none}.response img{padding:0;margin:2px}ul.cites{list-style:none;display:inline}.kind-embeds{text-align:center;position:relative;width:100%;margin-top:5px}
/*# sourceMappingURL=kind.min.css.map */
.response{
margin-left: 0;
padding: 15px;
background-color: rgba(0,0,0,0.025);
}
.response img{
vertical-align: middle;
}
.response blockquote{
margin-left: 0;
}
.indieweb-post-kinds-featured-image{
width: auto;
height: auto;
max-width: 100%;
}
.indieweb-post-kinds-categories{
font-size: 0.8em;
margin-top: 0.5em;
}
.indieweb-post-kinds-categories p{
display: none !important;
}
.indieweb-post-kinds-categories ul{
display: inline;
list-style: none;
margin: 0;
padding: 0;
margin-left: 0;
padding-left: 0;
}
.indieweb-post-kinds-categories li{
display: inline;
}
.indieweb-post-kinds-categories li:not(:last-child)::after{
display: inline;
content: ",";
}
<?php
/*
Default Template
* The Goal of this Template is to be a general all-purpose model that will be replaced by customization in other templates
*/
$author = array();
if ( isset( $cite['author'] ) ) {
$author = Kind_View::get_hcard( $cite['author'] );
}
$url = '';
if ( isset( $cite['url'] ) ) {
$url = $cite['url'];
}
$site_name = Kind_View::get_site_name( $cite );
$title = Kind_View::get_cite_title( $cite );
$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' ) );
}
$rsvp = $mf2_post->get( 'rsvp', true );
$featured = null;
if ( isset ( $cite['featured'] ) ) {
$featured = $cite['featured'];
}
$categories = null;
if ( isset ( $cite['category'] ) && ! empty ( $cite['category'] ) ) {
$categories = $cite['category'];
}
if ( ! $kind ) {
return;
}
// Add in the appropriate type
if ( ! empty( $type ) ) {
$type = ( empty( $url ) ? 'p-' : 'u-' ) . $type;
}
?>
<section class="h-cite response <?php echo $type; ?> ">
<header>
<?php
echo Kind_Taxonomy::get_before_kind( $kind );
if ( ! $embed ) {
if ( $title ) {
echo $title;
}
if ( ! empty( $author ) ) {
echo ' ' . __( 'by', 'indieweb-post-kinds' ) . ' ' . $author;
}
if ( $site_name ) {
echo '<em> (' . $site_name . ')</em>';
}
if ( in_array( $kind, array( 'jam', 'listen', 'play', 'read', 'watch', 'audio', 'video' ) ) ) {
if ( $duration ) {
echo '(<data class="p-duration" value="' . $duration . '">' . Kind_View::display_duration( $duration ) . '</data>)';
}
}
}
?>
</header>
<?php
if ( $featured ) {
echo '<img src="' . $featured . '" class="indieweb-post-kinds-featured-image u-featured" />';
}
if ( $cite && is_array( $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 ( $rsvp ) {
echo 'RSVP <span class="p-rsvp">' . $rsvp . '</span>';
}
if ( $categories ) {
echo '<div class="indieweb-post-kinds-categories"><span>' . __( 'Categories: ', 'indieweb-post-kinds' ) . '</span><ul>';
foreach ( $categories as $category ) {
echo '<li class="p-category">' . $category . '</li>';
}
echo '</ul></div>';
}
// Close Response
?>
</section>
<?php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment