Created
May 24, 2016 20:28
-
-
Save khromov/a627112f83d1a336643c5ebe89cebbff to your computer and use it in GitHub Desktop.
Set a page with slug "404-error" as your 404 page in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); ?> | |
<div class="container-fluid"> | |
<div class="content"> | |
<main role='main'> | |
<?php | |
$query_404 = new WP_Query(array( | |
'posts_per_page' => 1, | |
'post_type' => 'page', | |
'post_name' => '404-error' | |
)); | |
while ( $query_404->have_posts() ) : $query_404->the_post(); | |
get_template_part( 'content', 'page' ); | |
if ( comments_open() || get_comments_number() ) : | |
comments_template(); | |
endif; | |
endwhile; | |
wp_reset_postdata(); | |
?> | |
</main> | |
</div> | |
</div> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment