Sophia-After-Dark/template-parts/content.php

71 lines
1.8 KiB
PHP

<?php
/**
* Template part for displaying posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Sophia After Dark
* @since 1.0.0
*/
global $wp_query;
$current_post = $wp_query->current_post;
$archive_style = get_theme_mod( 'sophia_after_dark_archive_style', 'mt-archive--masonry-style' );
$post_content_type = apply_filters( 'sophia_after_dark_archive_post_content_type', 'excerpt' );
if ( has_post_thumbnail() ) {
$post_class = 'has-thumbnail';
} else {
$post_class = 'no-thumbnail';
}
if ( $current_post < 3 && 'mt-archive--masonry-style' === $archive_style ) {
$post_class .= '';
} else {
$post_class .= ' wow fadeInUp';
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>>
<?php
echo '<div class="thumb-cat-wrap">';
sophia_after_dark_post_thumbnail();
sophia_after_dark_article_categories_list();
echo '</div>';
if ( 'post' === get_post_type() ) {
?>
<div class="entry-cat">
<?php
sophia_after_dark_posted_on();
sophia_after_dark_posted_by();
?>
</div>
<?php } ?>
<header class="entry-header">
<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
</header>
<div class="entry-content">
<?php
if ( 'excerpt' === $post_content_type ) {
the_excerpt();
} elseif ( 'content' === $post_content_type ) {
the_content( sprintf(
wp_kses(
/* translators: %s: Name of current post. Only visible to screen readers */
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'sophia-after-dark' ),
array(
'span' => array(
'class' => array(),
),
)
),
get_the_title()
) );
}
?>
</div>
<footer class="entry-footer">
<?php sophia_after_dark_entry_footer(); ?>
</footer>
</article>