Last active
December 13, 2015 23:39
-
-
Save Vheissu/4993316 to your computer and use it in GitHub Desktop.
Custom 404 page template for displaying a custom editable Wordpress 404 page.
This file contains hidden or 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(); ?> | |
<?php | |
$the_page = null; | |
$errorpageid = get_option( '404pageid', 0 ); | |
if ($errorpageid !== 0) { | |
// Typecast to an integer | |
$errorpageid = (int) $errorpageid; | |
// Get our page | |
$the_page = get_page($errorpageid); | |
} | |
?> | |
<div id="four-oh-four"> | |
<?php if ($the_page == NULL || isset($the_page->post_content) && trim($the_page->post_content == '')): ?> | |
<h1>There was an error and nobody defined a custom 404 page message, so you're seeing this instead.</h1> | |
<?php else: ?> | |
<?php echo apply_filters( 'the_content', $the_page->post_content ); ?> | |
<?php endif; ?> | |
</div> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment