The code I use in my theme:
<?php
global $my_theme;
$content_id = $my_theme->option( OPT_GENERAL, '404_page_id', TRUE );
$my_theme->prepare( $content_id, '404' );
get_header();
?>
<!-- [BEGIN 404] -->
<div class="row">
<?php
get_sidebar( 'left' );
?>
<div id="primary" class="content-area <?php echo $class; ?>">
<main id="main" class="site-main" role="main">
<section class="error-404 not-found">
<?php
// Load the content from the selected page
$content_loaded = FALSE;
if( $content_id > 0 )
{
$query = new WP_Query( array( 'page_id' => $content_id ) );
while( $query->have_posts() )
{
$query->the_post();
get_template_part( 'content', 'page' );
$content_loaded = TRUE;
}
wp_reset_postdata();
}
// Fallback content
if( !$content_loaded )
{
?>
<header class="page-header">
<h4 class="page-title well text-center"><?php _e( 'Page not found', 'my_theme' ); ?></h4>
</header>
<div class="page-content alert alert-danger text-center">
<p><?php _e( 'It looks like nothing was found at this location', 'my_theme' ); ?></p>
</div>
<?php
}
?>
</section>
</main>
</div>
<?php get_sidebar( 'right' ); ?>
</div>
<?php get_footer(); ?>
<!-- [END 404] -->