<?php
	get_header();
?>
<?php do_action('ftm_before_content_hook'); ?>
<div class="ftm_404_content_wrapper site_content_wrapper">	   
    
    <?php 
    $args = array(
        'post_type' => 'page', 
        'post_title' => '404',         
        'post_status' => 'private'
    );

    $query = new WP_Query($args);
    
    $content = '';
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            global $post;
            if($post->post_title == '404'){
                $blocks = parse_blocks( get_the_content() );                

                foreach($blocks as $block){
                    $content .= render_block( $block );
                }
            }
            wp_reset_postdata(); 
        }        
     }

     if($content != ''){
        echo $content;
     }
     else //No page with the title 404 was found so we use the fixed default content
     {
    ?>
        <div class="content_container">
            <div class="left-column">
                <div class="child-div"><h1>404</h1></div>
                <div class="child-div"><b>Oops, we can’t find the page you’re looking for... </b></div>
            </div>
            <div class="right-column">
                <div class="child-div">
                    <img src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/page-not-found-min.png" />
                </div>
            </div>
        </div>
    <?php 
    } 
    ?>
</div><!-- .content-area -->

<?php get_footer(); ?>
