wp-rdnyc/content-templates/content-article.php

71 lines
2.1 KiB
PHP
Raw Normal View History

<?php
/**
* The article template.
*
* @author Recovery Dharma NYC
* @since 1.0.0
*/
namespace WP_RDNYC;
2021-07-28 22:51:24 -04:00
// for singular page, no extra bottom margin...
$post_class = is_singular() ? '' : ' mb-4-2 ';
2021-07-28 22:51:24 -04:00
$post_class .= 'post border-bottom border-spaceblue-700 pb-4';
$post_class = esc_attr( implode( ' ', get_post_class( $post_class ) ) );
?>
2021-07-28 22:51:24 -04:00
<article id="post-<?php the_ID(); ?>" class="<?php echo $post_class; ?>" itemscope itemtype="https://schema.org/CreativeWork">
<header class="post-header">
<?php
2021-07-28 22:51:24 -04:00
// post/page header inner content (title, with link for query/index listings)
$h_inner = ( is_archive() || is_search() || is_home() ) ?
'<a href="' . esc_url( get_the_permalink() ) . '" rel="bookmark">' . get_the_title() . '</a>' : get_the_title();
2021-07-28 16:39:40 -04:00
2021-07-28 22:51:24 -04:00
// For pages we want a larger heading like an index/query listing
// otherwise, a regular article/post header
echo (is_page() ? get_page_multi_heading( $h_inner ) : get_post_single_heading( $h_inner ));
2021-07-28 16:39:40 -04:00
?>
2021-07-28 22:51:24 -04:00
<?php // when not a page, we also output the published date
if (!is_page()) : ?>
<div class="post-date text-gray-400 mb-3" style="margin-top: -.33rem;">
<?php
if (get_the_title() === '') :
printf( '<a href="%s" rel="bookmark">%s</a>',
esc_url( get_the_permalink() ),
get_the_date('F j, Y')
);
else :
echo get_the_date('F j, Y');
endif;
?>
</div>
2021-07-28 16:39:40 -04:00
<?php endif; ?>
</header>
<div class="article post-body">
<?php
2021-07-28 16:39:40 -04:00
if ( has_post_thumbnail() ) {
echo get_the_post_thumbnail( get_the_ID(), 'large', ['class' => 'rounded shadow mt-1 mb-4 mw-100 h-auto'] );
2021-07-28 16:39:40 -04:00
}
2021-07-28 16:39:40 -04:00
the_content();
wp_link_pages(
array(
'before' => '<nav class="d-flex justify-content-center" aria-label="Page navigation for post ' . get_the_title() . '"><div class="d-flex align-items-center pe-2">Post pages:</div><div class="pagination">',
'after' => '</div></nav>',
'link_before' => '<span class="page-link">',
'link_after' => '</span>'
)
);
?>
</div>
2021-07-28 16:39:40 -04:00
</article>