Bump to 1.4.0, made some fixes for 8.2+

This commit is contained in:
2025-05-11 16:58:27 -07:00
parent 75cbf48af8
commit 5fd30040a4
14 changed files with 428 additions and 439 deletions

View File

@ -14,30 +14,32 @@ $author_url = get_the_author_meta( 'user_url' );
?>
<div class="mt-author-box">
<?php if ( $author_avatar ) { ?>
<?php if ( $author_avatar ) : ?>
<div itemprop="image" class="mt-author__avatar">
<?php echo wp_kses_post( $author_avatar ); ?>
</div>
<?php } ?>
<?php endif; ?>
<div class="mt-author-info">
<?php if ( $author_post_link ) { ?>
<h5 itemprop="name" class="mt-author-name"><?php echo wp_kses_post( $author_post_link ); ?></h5>
<?php } ?>
<?php if ( $author_post_link ) : ?>
<h5 itemprop="name" class="mt-author-name"><?php echo wp_kses_post( $author_post_link ); ?></h5>
<?php endif; ?>
<?php if ( $author_bio ) { ?>
<?php if ( $author_bio ) : ?>
<div class="mt-author-bio">
<?php echo wp_kses_post( $author_bio ); ?>
</div>
<?php } ?>
<?php endif; ?>
<div class="mt-author-meta">
<?php if ( $author_url ) { ?>
<?php if ( $author_url ) : ?>
<div class="mt-author-meta">
<div class="mt-author-website">
<span><?php esc_html_e( 'Website', 'sophia-after-dark' ); ?>&#58;</span>
<a href="<?php echo esc_url( $author_url ); ?>" target="_blank"><?php echo esc_url( $author_url ); ?></a>
<span><?php esc_html_e( 'Website', 'sophia-after-dark' ); ?>:</span>
<a href="<?php echo esc_url( $author_url ); ?>" target="_blank" rel="noopener noreferrer">
<?php echo esc_url( $author_url ); ?>
</a>
</div>
<?php } ?>
</div>
</div>
<?php endif; ?>
</div>
</div>

View File

@ -9,63 +9,55 @@
*/
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' );
$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';
// Determine post class
$post_class = has_post_thumbnail() ? 'has-thumbnail' : 'no-thumbnail';
if ( $current_post >= 3 || 'mt-archive--masonry-style' !== $archive_style ) {
$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 } ?>
<div class="thumb-cat-wrap">
<?php
sophia_after_dark_post_thumbnail();
sophia_after_dark_article_categories_list();
?>
</div>
<header class="entry-header">
<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
</header>
<?php if ( 'post' === get_post_type() ) : ?>
<div class="entry-cat">
<?php
sophia_after_dark_posted_on();
sophia_after_dark_posted_by();
?>
</div>
<?php endif; ?>
<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>
<header class="entry-header">
<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
</header>
<footer class="entry-footer">
<?php sophia_after_dark_entry_footer(); ?>
</footer>
</article>
<div class="entry-content">
<?php
if ( 'excerpt' === $post_content_type ) {
the_excerpt();
} elseif ( 'content' === $post_content_type ) {
the_content( sprintf(
wp_kses(
__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'sophia-after-dark' ),
[ 'span' => [ 'class' => [] ] ]
),
get_the_title()
) );
}
?>
</div>
<footer class="entry-footer">
<?php sophia_after_dark_entry_footer(); ?>
</footer>
</article>

View File

@ -6,40 +6,32 @@
* @since 1.0.0
*/
if (has_post_thumbnail()) {
$post_class = "has-thumbnail wow fadeInUp";
} else {
$post_class = "no-thumbnail wow fadeInUp";
} ?>
$post_class = has_post_thumbnail() ? "has-thumbnail wow fadeInUp" : "no-thumbnail wow fadeInUp";
?>
<article id="post-<?php the_ID(); ?>" <?php post_class($post_class); ?>>
<?php
echo '<div class="thumb-cat-wrap">';
if (has_post_thumbnail()) {
echo '<a href="' . esc_url(get_permalink()) . '" rel="bookmark">';
sophia_after_dark_post_thumbnail();
echo "</a>";
}
sophia_after_dark_article_categories_list();
echo "</div>";
if ("post" === get_post_type()) { ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $post_class ); ?>>
<div class="thumb-cat-wrap">
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
<?php sophia_after_dark_post_thumbnail(); ?>
</a>
<?php endif; ?>
<?php sophia_after_dark_article_categories_list(); ?>
</div>
<?php if ( "post" === get_post_type() ) : ?>
<div class="entry-cat">
<?php
sophia_after_dark_posted_on();
sophia_after_dark_posted_by();
?>
</div>
<?php }
?>
<?php endif; ?>
<header class="entry-header">
<?php the_title(
'<h2 class="entry-title"><a href="' .
esc_url(get_permalink()) .
'" rel="bookmark">',
"</a></h2>"
); ?>
</header>
<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
</header>
<footer class="entry-footer">
<?php sophia_after_dark_entry_footer(); ?>

View File

@ -6,39 +6,36 @@
* @since 1.0.0
*/
global $post;
$related_post_id = get_the_id();
$related_post_id = get_the_ID();
$get_categories = get_the_terms( $related_post_id, 'category' );
$selected_cat = array();
$selected_cat = ! empty( $get_categories ) && is_array( $get_categories ) ? wp_list_pluck( $get_categories, 'term_id' ) : [];
// Get only category slug of current post.
if ( $get_categories && is_array( $get_categories ) ) {
foreach ( $get_categories as $category ) {
$selected_cat[] = $category->term_id;
}
}
$related_posts_count = apply_filters( 'sophia_after_dark_related_posts_count', 3 );
$related_posts_title = apply_filters( 'sophia_after_dark_related_posts_section_title', __( 'Related Posts', 'sophia-after-dark' ) );
$related_posts_args = array(
$related_posts_args = [
'posts_per_page' => absint( $related_posts_count ),
'post__not_in' => array( $related_post_id ),
'post__not_in' => [ $related_post_id ],
'category__in' => $selected_cat,
);
];
$related_posts_query = new WP_Query( $related_posts_args );
if ( $related_posts_query->have_posts() ) {
if ( $related_posts_query->have_posts() ) :
?>
<section class="mt-single-related-posts">
<h2 class="mt-related-post-title"><?php echo esc_html( $related_posts_title ); ?></h2>
<div class="mt-related-posts-wrapper">
<?php
while ( $related_posts_query->have_posts() ) {
while ( $related_posts_query->have_posts() ) :
$related_posts_query->the_post();
get_template_part( 'template-parts/related/content', 'related' );
}
endwhile;
?>
</div>
</section>
<?php
}
endif;
wp_reset_postdata();