Files
Sophia-After-Dark/404.php
2025-05-20 23:47:21 -07:00

66 lines
2.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* The template for displaying 404 pages (not found)
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#404-not-found
*
* @package Sophia After Dark
* @since 1.0.0
*/
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" 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 cant 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>
</div>
</section>
<?php if ( true === $sophia_after_dark_pnf_latest_posts ) : ?>
<div class="page-extra-content sad-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="sad-pnf-latest-posts-wrapper sad-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 sad-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>
<?php endif; ?>
</main>
</div>
<?php
get_footer();