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

89
404.php
View File

@ -2,7 +2,7 @@
/**
* The template for displaying 404 pages (not found)
*
* @link https://codex.wordpress.org/Creating_an_Error_404_Pag
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#404-not-found
*
* @package Sophia After Dark
* @since 1.0.0
@ -12,53 +12,54 @@ get_header();
$sophia_after_dark_pnf_latest_posts = get_theme_mod( 'sophia_after_dark_enable_pnf_latest_posts', true );
?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main" aria-label="<?php esc_attr_e( '404 Error Content', 'sophia-after-dark' ); ?>">
<section class="error-404 not-found">
<div class="error-num"><span><?php esc_html_e( 'Error', 'sophia-after-dark' );?>&nbsp;</span><?php esc_html_e( '404', 'sophia-after-dark' ); ?></div>
<header class="page-header">
<h1 class="page-title"><?php esc_html_e( 'Oops! That page can&rsquo;t be found.', 'sophia-after-dark' ); ?></h1>
</header>
<div class="page-content">
<p><?php esc_html_e( 'It looks like nothing was found at this location.', 'sophia-after-dark' ); ?></p>
</section>
<?php if ( true === $sophia_after_dark_pnf_latest_posts ) { ?>
<div class="page-extra-content mt-404-latest-posts-wrapper">
<?php
$sophia_after_dark_pnf_latest_post_count = get_theme_mod( 'sophia_after_dark_pnf_latest_post_count', 3 );
$sophia_after_dark_pnf_args = array(
'post_type' => 'post',
'posts_per_page' => absint( $sophia_after_dark_pnf_latest_post_count ),
'ignore_sticky_posts' => 1,
);
$sophia_after_dark_pnf_query = new WP_Query( $sophia_after_dark_pnf_args );
if ( $sophia_after_dark_pnf_query->have_posts() ) {
echo '<div class="mt-pnf-latest-posts-wrapper mt-related-posts-wrapper">';
$sophia_after_dark_404_latest_title = get_theme_mod( 'sophia_after_dark_pnf_latest_title', __( 'You May Like' ,'sophia-after-dark' ) );
echo '<h2 class="section-title mt-related-post-title">'. esc_html( $sophia_after_dark_404_latest_title ) .'</h2>';
while ( $sophia_after_dark_pnf_query->have_posts() ) {
$sophia_after_dark_pnf_query->the_post();
/*
* Include the Post-Type-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
*/
get_template_part( 'template-parts/content', 'related' );
}
echo '</div>';
}
wp_reset_postdata();
?>
<section class="error-404 not-found">
<div class="error-num">
<span><?php esc_html_e( 'Error', 'sophia-after-dark' ); ?>&nbsp;</span><?php esc_html_e( '404', 'sophia-after-dark' ); ?>
</div>
<?php } ?>
<header class="page-header">
<h1 class="page-title"><?php esc_html_e( 'Oops! That page cant be found.', 'sophia-after-dark' ); ?></h1>
</header>
</main>
</div>
<div class="page-content">
<p><?php esc_html_e( 'It looks like nothing was found at this location.', 'sophia-after-dark' ); ?></p>
</div><!-- .page-content -->
</section><!-- .error-404 -->
<?php if ( true === $sophia_after_dark_pnf_latest_posts ) : ?>
<div class="page-extra-content mt-404-latest-posts-wrapper">
<?php
$sophia_after_dark_pnf_latest_post_count = get_theme_mod( 'sophia_after_dark_pnf_latest_post_count', 3 );
$sophia_after_dark_pnf_args = array(
'post_type' => 'post',
'posts_per_page' => absint( $sophia_after_dark_pnf_latest_post_count ),
'ignore_sticky_posts' => 1,
);
$sophia_after_dark_pnf_query = new WP_Query( $sophia_after_dark_pnf_args );
if ( $sophia_after_dark_pnf_query->have_posts() ) :
echo '<div class="mt-pnf-latest-posts-wrapper mt-related-posts-wrapper">';
$sophia_after_dark_404_latest_title = get_theme_mod( 'sophia_after_dark_pnf_latest_title', __( 'You May Like', 'sophia-after-dark' ) );
echo '<h2 class="section-title mt-related-post-title">' . esc_html( $sophia_after_dark_404_latest_title ) . '</h2>';
while ( $sophia_after_dark_pnf_query->have_posts() ) :
$sophia_after_dark_pnf_query->the_post();
get_template_part( 'template-parts/content', 'related' );
endwhile;
echo '</div>';
endif;
wp_reset_postdata();
?>
</div><!-- .mt-404-latest-posts-wrapper -->
<?php endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();

View File

@ -12,52 +12,59 @@ $archive_style = get_theme_mod( 'sophia_after_dark_archive_style', 'mt-archive--
get_header();
?>
<div class="mt-page-content-wrapper">
<div itemscope id="primary" class="content-area">
<main id="main" class="site-main">
<?php
if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '<div class="archive-grid-post-wrapper">';
}
if ( have_posts() ) :
if ( 'mt-archive--masonry-style' === $archive_style ) {
?>
<div id="primary" class="content-area" itemscope itemtype="https://schema.org/CollectionPage">
<main id="main" class="site-main" role="main" aria-label="<?php esc_attr_e( 'Archive Content', 'sophia-after-dark' ); ?>">
<?php if ( 'mt-archive--block-grid-style' === $archive_style ) : ?>
<div class="archive-grid-post-wrapper">
<?php endif; ?>
<?php if ( have_posts() ) : ?>
<?php if ( 'mt-archive--masonry-style' === $archive_style ) : ?>
<div class="sophia-after-dark-content-masonry">
<div id="mt-masonry">
<?php
}
/* Start the Loop */
while ( have_posts() ) :
the_post();
/*
* Include the Post-Type-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_type() );
<?php endif; ?>
endwhile;
<?php
// Start the Loop
while ( have_posts() ) :
the_post();
if ( 'mt-archive--masonry-style' === $archive_style ) {
?>
</div>
</div>
<?php
}
// Load post template part
get_template_part( 'template-parts/content', get_post_type() );
the_posts_pagination();
else :
get_template_part( 'template-parts/content', 'none' );
endwhile;
?>
endif;
<?php if ( 'mt-archive--masonry-style' === $archive_style ) : ?>
</div><!-- #mt-masonry -->
</div><!-- .sophia-after-dark-content-masonry -->
<?php endif; ?>
if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '</div>';
}
?>
</main>
</div>
<?php
// Archive pagination
the_posts_pagination( array(
'prev_text' => __( 'Previous', 'sophia-after-dark' ),
'next_text' => __( 'Next', 'sophia-after-dark' ),
'before_page_number' => '<span class="screen-reader-text">' . esc_html__( 'Page', 'sophia-after-dark' ) . ' </span>',
) );
?>
<?php else : ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php endif; ?>
<?php if ( 'mt-archive--block-grid-style' === $archive_style ) : ?>
</div><!-- .archive-grid-post-wrapper -->
<?php endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div>
<?php
get_footer();
</div><!-- .mt-page-content-wrapper -->
<?php get_footer(); ?>

View File

@ -20,68 +20,76 @@ if ( post_password_required() ) {
return;
}
// Remove URL field from comments
// Remove URL field from comment form
function sophia_after_dark_remove_url_comments($fields) {
unset($fields['url']);
return $fields;
unset($fields['url']);
return $fields;
}
add_filter('comment_form_default_fields', 'sophia_after_dark_remove_url_comments');
// Edit Cookie consent text from comments
// Modify cookie consent field
function sophia_after_dark_comment_form_change_cookies($fields) {
$commenter = wp_get_current_commenter();
$consent = empty($commenter['comment_author_email']) ? '' : ' checked="checked"';
$fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . esc_attr($consent) . ' /><label for="wp-comment-cookies-consent">' . esc_html__('Save my Name & Email for the next time I comment.', 'sophia-after-dark') . '</label></p>';
return $fields;
$commenter = wp_get_current_commenter();
$consent = ! empty( $commenter['comment_author_email'] );
$fields['cookies'] = sprintf(
'<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" %s /> <label for="wp-comment-cookies-consent">%s</label></p>',
checked( $consent, true, false ),
esc_html__( 'Save my Name & Email for the next time I comment.', 'sophia-after-dark' )
);
return $fields;
}
add_filter('comment_form_default_fields', 'sophia_after_dark_comment_form_change_cookies');
// Edit comment-notes text from comments
// Add comment notes above form
function sophia_after_dark_modify_text_before_comment_form($arg) {
$arg['comment_notes_before'] = wp_kses_post(
'<p class="comment-notes">' .
esc_html__('All comments are manually reviewed and moderated.', 'sophia-after-dark') .
'<br><span class="required-field-message">' .
esc_html__('Required fields are marked ', 'sophia-after-dark') .
'<span class="required">*</span></span></p>'
);
return $arg;
$arg['comment_notes_before'] = wp_kses_post(
'<p class="comment-notes">' .
esc_html__('All comments are manually reviewed and moderated.', 'sophia-after-dark') .
'<br><span class="required-field-message">' .
esc_html__('Required fields are marked ', 'sophia-after-dark') .
'<span class="required">*</span></span></p>'
);
return $arg;
}
add_filter('comment_form_defaults', 'sophia_after_dark_modify_text_before_comment_form');
// Add note below comment form about privacy policy consent
// Add privacy policy consent note below form
function sophia_after_dark_modify_text_comment_form($post_id) {
printf(
'<span class="submit-comment-note">%s</span>',
wp_kses(
__('By commenting, you consent to our <a href="/privacy-policy">Privacy Policy</a>', 'sophia-after-dark'),
array('a' => array('href' => array()))
)
);
$link = '<a href="/privacy-policy">' . esc_html__( 'Privacy Policy', 'sophia-after-dark' ) . '</a>';
printf(
'<span class="submit-comment-note">%s</span>',
sprintf(
wp_kses(
__( 'By commenting, you consent to our %s.', 'sophia-after-dark' ),
array( 'a' => array( 'href' => array() ) )
),
$link
)
);
}
add_action('comment_form', 'sophia_after_dark_modify_text_comment_form');
?>
<div id="comments" class="comments-area">
<?php
if ( have_comments() ) :
?>
<h2 class="comments-title">
<?php if ( have_comments() ) : ?>
<h2 class="comments-title" aria-label="<?php esc_attr_e( 'Comments Section', 'sophia-after-dark' ); ?>">
<?php
$sophia_after_dark_comment_count = get_comments_number();
if ( '1' === $sophia_after_dark_comment_count ) {
printf(
/* translators: 1: title. */
esc_html__( 'One Comment on &ldquo;%1$s&rdquo;', 'sophia-after-dark' ),
'<span>' . esc_html(get_the_title()) . '</span>'
/* translators: %s: Post title */
esc_html__( 'One Comment on “%s”', 'sophia-after-dark' ),
'<span>' . esc_html( get_the_title() ) . '</span>'
);
} else {
printf(
/* translators: 1: comment count number, 2: title. */
esc_html( _nx( '%1$s Comments on &ldquo;%2$s&rdquo;', '%1$s Comments on &ldquo;%2$s&rdquo;', $sophia_after_dark_comment_count, 'comments title', 'sophia-after-dark' ) ),
/* translators: 1: Comment count, 2: Post title */
esc_html( _nx( '%1$s Comment on “%2$s”', '%1$s Comments on “%2$s”', $sophia_after_dark_comment_count, 'comments title', 'sophia-after-dark' ) ),
number_format_i18n( $sophia_after_dark_comment_count ),
'<span>' . esc_html(get_the_title()) . '</span>'
'<span>' . esc_html( get_the_title() ) . '</span>'
);
}
?>
@ -92,24 +100,19 @@ add_action('comment_form', 'sophia_after_dark_modify_text_comment_form');
<ol class="comment-list">
<?php
wp_list_comments( array(
'style' => 'ol',
'short_ping' => true,
'style' => 'ol',
'short_ping' => true,
'reply_text' => __( 'Reply', 'sophia-after-dark' ),
) );
?>
</ol>
<?php
the_comments_navigation();
<?php the_comments_navigation(); ?>
if ( ! comments_open() ) :
?>
<?php if ( ! comments_open() ) : ?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'sophia-after-dark' ); ?></p>
<?php
endif;
endif;
comment_form();
?>
<?php endif; ?>
<?php endif; ?>
<?php comment_form(); ?>
</div>

View File

@ -197,3 +197,40 @@ require get_template_directory() . '/inc/metaboxes/mt-post-sidebar-meta.php';
if ( ! function_exists( 'breadcrumb_trail' ) ) {
require get_template_directory() . '/inc/mt-class-breadcrumbs.php';
}
// Function to allow images in WordPress comments
function allow_images_in_comments($comment_content) {
// Allow only specific HTML tags, including <img>
$allowed_tags = array(
'a' => array('href' => array(), 'title' => array()),
'em' => array(),
'strong' => array(),
'img' => array(
'src' => array(),
'alt' => array(),
'width' => array(),
'height' => array(),
'class' => array(),
),
);
// Strip out disallowed tags but keep allowed ones
return wp_kses($comment_content, $allowed_tags);
}
// Hook to filter the comment text before displaying it
add_filter('comment_text', 'allow_images_in_comments');
// Function to make URLs for images clickable in comments
function clickable_images_in_comments($comment_content) {
// Automatically convert image URLs to HTML <img> tags
$comment_content = preg_replace(
'/(http:\/\/[^\s"]+\.(jpg|jpeg|png|gif))/i',
'<img src="$1" alt="" class="comment-image" />',
$comment_content
);
return $comment_content;
}
// Hook to make image URLs clickable
add_filter('comment_text', 'clickable_images_in_comments');

View File

@ -14,130 +14,76 @@
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="https://gmpg.org/xfn/11">
<?php
$author_id = get_option('sophia_after_dark_home_og_user', 1); // Default to user ID 1 if not set
$author_bio = get_the_author_meta('description', $author_id);
// Set default author for home page OG metadata
$author_id = (int) get_option( 'sophia_after_dark_home_og_user', 1 );
$author_bio = get_the_author_meta( 'description', $author_id );
echo '<meta charset="' . get_bloginfo('charset') . '">' . "\n";
echo '<meta name="viewport" content="width=device-width, initial-scale=1">' . "\n";
if ( is_front_page() ) {
$home_og_image = get_option( 'sophia_after_dark_home_og_image' );
if (is_front_page()) {
$home_og_image = get_option('sophia_after_dark_home_og_image');
if ($home_og_image) {
echo '<meta property="og:image" content="' . esc_url($home_og_image) . '" />' . "\n";
}
echo '<meta property="og:title" content="' . esc_attr(get_bloginfo('name') . ' - ' . get_bloginfo('description')) . '" />' . "\n";
echo '<meta property="og:description" content="' . esc_attr($author_bio) . '" />' . "\n";
echo '<meta property="og:url" content="' . esc_url(home_url('/')) . '" />' . "\n";
} elseif (is_single() || is_page()) {
global $post;
if (has_post_thumbnail($post->ID)) {
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'og-image-size');
if ($thumbnail) {
echo '<meta property="og:image" content="' . esc_url($thumbnail[0]) . '" />' . "\n";
// $thumbnail_url = esc_url($thumbnail[0]);
// $thumbnail_parts = pathinfo($thumbnail_url);
// $thumbnail_new_url = $thumbnail_parts['dirname'] . '/' . $thumbnail_parts['filename'] . '-1536x878.' . $thumbnail_parts['extension'];
// echo '<meta property="og:image" content="' . $thumbnail_new_url . '" />' . "\n";
}
} else {
echo '<meta property="og:image" content="' . esc_url(get_template_directory_uri() . '/assets/images/default-og-image.webp') . '" />' . "\n";
}
echo '<meta property="og:title" content="' . esc_attr(get_the_title()) . '" />' . "\n";
echo '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />' . "\n";
echo '<meta property="og:url" content="' . esc_url(get_permalink()) . '" />' . "\n";
if ( $home_og_image ) {
printf( '<meta property="og:image" content="%s" />' . "\n", esc_url( $home_og_image ) );
}
echo '<link rel="profile" href="https://gmpg.org/xfn/11">' . "\n";
wp_head();
printf( '<meta property="og:title" content="%s" />' . "\n", esc_attr( get_bloginfo( 'name' ) . ' - ' . get_bloginfo( 'description' ) ) );
printf( '<meta property="og:description" content="%s" />' . "\n", esc_attr( $author_bio ) );
printf( '<meta property="og:url" content="%s" />' . "\n", esc_url( home_url( '/' ) ) );
} elseif ( is_singular() ) {
global $post;
$thumbnail_url = get_template_directory_uri() . '/assets/images/default-og-image.webp';
if ( has_post_thumbnail( $post?->ID ) ) {
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'og-image-size' );
if ( ! empty( $image[0] ) ) {
$thumbnail_url = $image[0];
}
}
printf( '<meta property="og:image" content="%s" />' . "\n", esc_url( $thumbnail_url ) );
printf( '<meta property="og:title" content="%s" />' . "\n", esc_attr( get_the_title() ) );
printf( '<meta property="og:description" content="%s" />' . "\n", esc_attr( get_the_excerpt() ) );
printf( '<meta property="og:url" content="%s" />' . "\n", esc_url( get_permalink() ) );
}
wp_head();
?>
</head>
<body <?php body_class(); ?>>
<?php
if ( function_exists( 'wp_body_open' ) ) {
wp_body_open();
} else {
/**
* Hook: wp_body_open
*
* @since 1.1.0
*/
do_action( 'wp_body_open' );
}
if ( function_exists( 'wp_body_open' ) ) {
wp_body_open();
} else {
do_action( 'wp_body_open' ); // Backwards compatibility for < WP 5.2
}
/**
* sophia_after_dark before page hook
*
* @since 1.0.0
*/
do_action( 'sophia_after_dark_before_page' );
do_action( 'sophia_after_dark_before_page' );
?>
<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip To Content', 'sophia-after-dark' ) ?></a>
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'sophia-after-dark' ); ?></a>
<?php
/**
* sophia_after_dark before header
*
* @since 1.0.0
*/
do_action( 'sophia_after_dark_before_header' );
// Top Header
if ( get_theme_mod( 'sophia_after_dark_enable_top_header', true ) ) {
do_action( 'sophia_after_dark_top_header' );
}
$sophia_after_dark_enable_top_header = get_theme_mod( 'sophia_after_dark_enable_top_header', true );
if ( true === $sophia_after_dark_enable_top_header ) {
/**
* hook - sophia_after_dark_top_header
*
* @hooked - sophia_after_dark_top_header_start - 5
* @hooked - sophia_after_dark_trending_section - 10
* @hooked - sophia_after_dark_top_header_nav - 20
* @hooked - sophia_after_dark_top_header_end - 50
*/
do_action( 'sophia_after_dark_top_header' );
}
// Main Header
do_action( 'sophia_after_dark_main_header' );
/**
* sophia_after_dark main header
*
* @hooked - sophia_after_dark_main_header_start - 5
* @hooked - sophia_after_dark_site_branding - 10
* @hooked - sophia_after_dark_menu_wrapper_start - 15
* @hooked - sophia_after_dark_header_main_menu - 20
* @hooked - sophia_after_dark_menu_icon_wrapper_start - 25
* @hooked - sophia_after_dark_menu_social_icons - 30
* @hooked - sophia_after_dark_menu_search_icon - 35
* @hooked - sophia_after_dark_menu_icon_wrapper_end - 40
* @hooked - sophia_after_dark_menu_wrapper_end - 45
* @hooked - sophia_after_dark_main_header_end - 50
*
* @since 1.0.0
*/
do_action( 'sophia_after_dark_main_header' );
if ( is_front_page() ) {
/**
* hook - front_slider_section
* displays front top section before archive blogs.
*/
do_action( 'sophia_after_dark_front_slider_section' );
}
if ( ! is_front_page() ) {
/**
* sophia_after_dark_innerpage_header hook
*
* @hooked - sophia_after_dark_innerpage_header_start - 5
* @hooked - sophia_after_dark_innerpage_header_title - 10
* @hooked - sophia_after_dark_breadcrumb_content - 15
* @hooked - sophia_after_dark_innerpage_header_end - 20
*
* @since 1.0.0
*/
do_action( 'sophia_after_dark_innerpage_header' );
}
// Front page slider or inner page header
if ( is_front_page() ) {
do_action( 'sophia_after_dark_front_slider_section' );
} else {
do_action( 'sophia_after_dark_innerpage_header' );
}
?>
<div id="content" class="site-content">

View File

@ -12,55 +12,55 @@
* @package Sophia After Dark
* @since 1.0.0
*/
$archive_style = get_theme_mod( 'sophia_after_dark_archive_style', 'mt-archive--masonry-style' );
declare(strict_types=1);
get_header();
$archive_style = get_theme_mod('sophia_after_dark_archive_style', 'mt-archive--masonry-style');
?>
<div class="mt-page-content-wrapper">
<div itemscope id="primary" class="content-area">
<main id="main" class="site-main">
<?php
if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '<div class="archive-grid-post-wrapper">';
}
if ( have_posts() ) :
if ( 'mt-archive--masonry-style' === $archive_style ) {
?>
<?php if ('mt-archive--block-grid-style' === $archive_style): ?>
<div class="archive-grid-post-wrapper">
<?php endif; ?>
<?php if (have_posts()): ?>
<?php if ('mt-archive--masonry-style' === $archive_style): ?>
<div class="sophia-after-dark-content-masonry">
<div id="mt-masonry">
<?php
}
/* Start the Loop */
while ( have_posts() ) :
the_post();
<?php endif; ?>
/*
* Include the Post-Type-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_format() );
endwhile;
<?php
while (have_posts()):
the_post();
get_template_part('template-parts/content', get_post_format());
endwhile;
?>
if ( 'mt-archive--masonry-style' === $archive_style ) {
?>
</div>
</div>
<?php
}
<?php if ('mt-archive--masonry-style' === $archive_style): ?>
</div> <!-- #mt-masonry -->
</div> <!-- .sophia-after-dark-content-masonry -->
<?php endif; ?>
the_posts_pagination();
else :
get_template_part( 'template-parts/content', 'none' );
endif;
<?php the_posts_pagination(); ?>
<?php else: ?>
<?php get_template_part('template-parts/content', 'none'); ?>
<?php endif; ?>
<?php if ('mt-archive--block-grid-style' === $archive_style): ?>
</div> <!-- .archive-grid-post-wrapper -->
<?php endif; ?>
if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '</div>';
}
?>
</main>
</div>
<?php get_sidebar(); ?>
</div>
<?php
get_footer();
<?php get_footer(); ?>

View File

@ -15,23 +15,27 @@
get_header();
?>
<div class="mt-page-content-wrapper">
<div itemscope id="primary" class="content-area">
<main id="main" class="site-main">
<?php
while ( have_posts() ) :
the_post();
<div id="primary" class="content-area" itemscope itemtype="https://schema.org/WebPage">
<main id="main" class="site-main" role="main" aria-label="<?php esc_attr_e( 'Page Content', 'sophia-after-dark' ); ?>">
get_template_part( 'template-parts/content', 'page' );
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', 'page' );
// Load comments if open or at least one exists.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile;
?>
</main><!-- #main -->
</div><!-- #primary -->
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; // End of the loop.
?>
</main>
</div>
<?php get_sidebar(); ?>
</div>
</div><!-- .mt-page-content-wrapper -->
<?php
get_footer();

View File

@ -12,47 +12,51 @@ get_header();
?>
<div class="mt-page-content-wrapper">
<section id="primary" class="content-area">
<main id="main" class="site-main">
<?php
if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '<div class="archive-grid-post-wrapper">';
}
<main id="main" class="site-main" role="main" aria-label="<?php esc_attr_e( 'Search Results', 'sophia-after-dark' ); ?>">
<?php
if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '<div class="archive-grid-post-wrapper">';
}
if ( have_posts() ) :
if ( 'mt-archive--masonry-style' === $archive_style ) {
if ( 'mt-archive--masonry-style' === $archive_style ) :
?>
<div class="sophia-after-dark-content-masonry">
<div id="mt-masonry">
<?php
}
/* Start the Loop */
while ( have_posts() ) :
the_post();
/*
* Include the Post-Type-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
*/
get_template_part( 'template-parts/content', 'search' );
endwhile;
endif;
if ( 'mt-archive--masonry-style' === $archive_style ) {
/* Start the Loop */
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', 'search' );
endwhile;
if ( 'mt-archive--masonry-style' === $archive_style ) :
?>
</div>
</div>
</div><!-- #mt-masonry -->
</div><!-- .sophia-after-dark-content-masonry -->
<?php
}
endif;
the_posts_pagination();
else :
get_template_part( 'template-parts/content', 'none' );
endif;
if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '</div>';
}
?>
</main>
</section>
if ( 'mt-archive--block-grid-style' === $archive_style ) {
echo '</div><!-- .archive-grid-post-wrapper -->';
}
?>
</main><!-- #main -->
</section><!-- #primary -->
<?php get_sidebar(); ?>
</div>
</div><!-- .mt-page-content-wrapper -->
<?php
get_footer();

View File

@ -11,9 +11,9 @@
get_header();
?>
<div class="mt-page-content-wrapper">
<div itemscope id="primary" class="content-area">
<main id="main" class="site-main">
<?php
<div id="primary" class="content-area" itemscope itemtype="https://schema.org/Article">
<main id="main" class="site-main" role="main" aria-label="<?php esc_attr_e( 'Single Post Content', 'sophia-after-dark' ); ?>">
<?php
while ( have_posts() ) :
the_post();
@ -21,20 +21,24 @@ get_header();
the_post_navigation();
// If comments are open or we have at least one comment, load up the comment template.
// Load comments template if comments are open or exist.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile; // End of the loop.
endwhile;
// Load related posts section if enabled in theme settings.
$related_posts_option = get_theme_mod( 'sophia_after_dark_enable_related_posts', true );
if ( true === $related_posts_option && 'post' === get_post_type() ) {
get_template_part( 'template-parts/related/related', 'posts' );
}
?>
</main>
</div>
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div>
</div><!-- .mt-page-content-wrapper -->
<?php
get_footer();

View File

@ -3,9 +3,9 @@ Theme Name: Sophia After Dark
Author: Sophia Atkinson, Mystery Themes
Author URI: https://sophia.wtf
Description: Sophia After Dark is a page builder based and colorful free blog style WordPress theme fit for writers and bloggers. With the help of live customizer option makes your site own and present your content in an attractive way. It comes up with an amazing creative blog layouts, fully RTL and translation ready, and also compatible with Gutenberg. The theme works perfectly with Elementor that helps to create a beautiful and unique website faster. As its name suggests, it added staggering variety of color and makes your site attractive and elegant.
Version: 1.3.3
Version: 1.4.0
Requires at least: 4.7
Tested up to: 6.0.2
Tested up to: 6.8.1
Requires PHP: 5.2.4
License: GNU General Public License v3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

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>
<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,39 +6,31 @@
* @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>"
); ?>
<?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
</header>
<footer class="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();