<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
<?php
/**
 * The template for displaying pages.
 */

get_header();

Beruco_Wp_Elements::$template = 'archive';
Beruco_Wp_Elements::$beruco_page_options = get_post_meta( get_the_ID(), 'beruco_post_meta', true );

?>

<main id="site-content">

	<?php 
		/*
		* Page title template call
		*/
		get_template_part( 'template-parts/page', 'title' );
	?>

	<div class="beruco-content-wrap container page">
		<div class="row">
			<div class="col">
				<div class="section-inner thin error404-content">				
					<?php
				$building_tool = Beruco_Wp_Elements::beruco_options('404_building_tool');
				switch ($building_tool) {
				    case 'elementor':
				        $selected_page_id = Beruco_Wp_Elements::beruco_options('404-page-selector');
				        $page = get_post($selected_page_id);
				        if ($page && !is_wp_error($page)) {
				            echo '<div class="elementor-content">';
				            echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display($selected_page_id);
				            echo '</div>';
				        } else {
				            echo '<h1 class="entry-title">' . __('Page Not Found', 'beruco') . '</h1>';
				            echo '<div class="intro-text"><p>' . __('The page you were looking for could not be found. It might have been removed, renamed, or did not exist in the first place.', 'beruco') . '</p></div>';
				            get_search_form(array('label' => __('404 not found', 'beruco')));
				        }
				        break;

				    case 'default':
				        echo '<h1 class="entry-title">' . __('Page Not Found', 'beruco') . '</h1>';
				        echo '<div class="intro-text"><p>' . __('The page you were looking for could not be found. It might have been removed, renamed, or did not exist in the first place.', 'beruco') . '</p></div>';
				        get_search_form(array('label' => __('404 not found', 'beruco')));
				        break;

				    default:
				        echo '<h1 class="entry-title">' . __('No template is selected', 'beruco') . '</h1>';
				        echo '<div class="intro-text"><p>' . __('Choose the template that should be shown in the 404 Page', 'beruco') . '</p></div>';
				        get_search_form(array('label' => __('404 not found', 'beruco')));
				}
				?>
				</div><!-- .section-inner -->
			</div><!-- .col -->
		</div><!-- .row -->
	</div><!-- .container -->
</main><!-- #site-content -->

<?php get_footer(); ?>
