2018-03-21 18:19:20 +00:00
< ? php
2021-01-22 16:19:51 +00:00
/**
* The template part for displaying content .
*
* @ package Omphaloskepsis
* @ since Omphaloskepsis 1.0
*/
2018-03-21 18:19:20 +00:00
?>
2021-01-22 16:19:51 +00:00
< ? php
// For Posts with a) a single external link and b) no body content, just make
// the item link directly to the external resource.
$has_one_external_link = count ( get_post_meta ( get_the_ID (), 'External_Link' , false ) ) === 1 ;
$has_body_content = ! ! get_the_content ();
$links_externally = $has_one_external_link && ! $has_body_content ;
2021-02-14 13:26:05 +00:00
$split_link = explode ( ';;' , get_post_meta ( get_the_ID (), 'External_Link' , true ) );
$link_href = ( count ( $split_link ) > 1 ) ? $split_link [ 1 ] : $split_link [ 0 ];
$post_link = ( $links_externally ) ? $link_href : get_the_permalink ( get_the_ID () );
2021-01-22 16:19:51 +00:00
?>
< a class = " item " href = " <?php echo esc_url( $post_link ); ?> " < ? php echo ( $links_externally ) ? ' target="_blank" rel="noopener noreferrer"' : '' ; ?> >
< article id = " post-<?php the_ID(); ?> " class = " tile col-m-6 col-4 col-w-3 " style = " background-image: url('<?php the_post_thumbnail_url(); ?>'); " >
< ? php
2021-02-14 14:46:26 +00:00
$title_length = strlen ( get_the_title () );
if ( $title_length > 70 ) {
2021-01-09 11:13:06 +00:00
$small = 'vsmall' ;
2021-02-14 14:46:26 +00:00
} elseif ( $title_length > 35 ) {
2021-01-09 11:13:06 +00:00
$small = 'small' ;
2021-02-14 14:46:26 +00:00
} elseif ( $title_length > 12 ) {
2021-01-09 11:13:06 +00:00
$small = 'qsmall' ;
}
?>
2021-01-22 16:19:51 +00:00
< header >
2021-02-14 13:26:05 +00:00
< ? php
$post_status = get_post_meta ( get_the_ID (), 'Status' , true );
if ( $post_status ) :
?>
< span class = " status-banner status-banner--<?php echo esc_attr( lcfirst( $post_status ) ); ?> " >< ? php echo wp_kses_post ( $post_status ); ?> </span>
< ? php endif ; ?>
2021-02-14 14:46:26 +00:00
< ? php
$source = get_post_meta ( get_the_ID (), 'Source' , true );
if ( $source ) :
?>
< span class = " source-banner " >< ? php echo wp_kses_post ( $source ); ?> </span>
< ? php endif ; ?>
2021-01-22 16:19:51 +00:00
< h1 class = " <?php echo esc_attr( $small ); ?> post-title " >
< ? php echo wp_kses_post ( get_the_title () ); ?>
</ h1 >
2021-02-14 14:46:26 +00:00
< ? php
$subtitle = get_post_meta ( get_the_ID (), 'Subtitle' , true );
if ( $subtitle ) :
?>
2021-01-22 16:19:51 +00:00
< h2 >
2021-02-14 14:46:26 +00:00
< ? php echo wp_kses_post ( $subtitle ); ?>
2021-01-22 16:19:51 +00:00
</ h2 >
2021-02-14 14:46:26 +00:00
< ? php endif ; ?>
2021-01-22 16:19:51 +00:00
</ header >
</ article ><!-- #post-## -->
2021-01-09 11:13:06 +00:00
</ a >