Sophia-After-Dark/404.php

64 lines
2.4 KiB
PHP

<?php
/**
* The template for displaying 404 pages (not found)
*
* @link https://codex.wordpress.org/Creating_an_Error_404_Pag
*
* @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">
<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();
?>
</div>
<?php } ?>
</main>
</div>
<?php
get_footer();