<?php
/**
 * Default Events Template
 * This file is the basic wrapper template for all the views if 'Default Events Template'
 * is selected in Events -> Settings -> Template -> Events Template.
 *
 * Override this template in your own theme by creating a file at [your-theme]/tribe-events/default-template.php
 *
 * @package TribeEventsCalendar
 *
 */

if ( ! defined( 'ABSPATH' ) ) {
	die( '-1' );
}

get_header();
$page = get_field('events_page', 'options');
?>
<?php if(has_post_thumbnail($page->ID)){ 
		$id = get_post_thumbnail_id( $page->ID  ); 
        $url = wp_get_attachment_image_url($id, 'large'); } 
        else { $url = get_bloginfo('template_url').'/img/hero-image.jpg'; } ?>
    <header id="header" style="background-image:url(<?php echo $url; ?>);">
        <div class="header-info">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-xs-12 col-md-6 col-md-offset-3 col-sm-10 col-sm-offset-1">
                        <h1><?php if(is_singular('tribe_events')){ the_title( '<h1 class="tribe-events-single-event-title">', '</h1>' );  } else { echo $page->post_title; } ?></h1>
                    </div>
                </div>
            </div>
        </div>
    </header>
<div class="container-fluid">
    <div id="tribe-events-pg-template">
        <div class="content">
            <?php tribe_events_before_html(); ?>
            <?php tribe_get_view(); ?>
            <?php tribe_events_after_html(); ?>
        </div>
    </div> <!-- #tribe-events-pg-template -->
</div>
<?php
get_footer();
