<?php
/*
Template Name: Magazine Front Page
*/
if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly.
}
?>
<?php get_header(); ?>
<?php // Get Theme Options from Database
	$theme_options = pmthemes_theme_options();
?>
	<div id="wrap" class="clearfix template-frontpage">
		<section id="content" class="primary" role="main">
		<?php // Display Featured Post Slideshow if activated
		if ( isset($theme_options['slider_activated_front_page']) and $theme_options['slider_activated_front_page'] == true ) :
			get_template_part( 'template-parts/featured-content-slider' );
		endif; ?>
		<?php // Display Frontpage Widgets
		if(is_active_sidebar('frontpage-magazine')) : ?>
			<div id="frontpage-magazine-widgets" class="clearfix">
				<?php dynamic_sidebar('frontpage-magazine'); ?>
			</div>
		<?php // Display Description about Magazine Homepage Widgets when widget area is empty
		else : 
			// Display only to users with permission
			if ( current_user_can( 'edit_theme_options' ) ) : ?>
			<p class="frontpage-magazine-no-widgets">
				<?php _e('There are no widgets to be displayed. Please go to Appearance -> Widgets and add at least one widget to the "Magazine Front Page" widget area. You can use the three Category Posts widgets to set up the theme like the demo website.', 'pmthemes'); ?>
			</p>
			<?php endif;
		endif; ?>
		</section>
		<?php get_sidebar(); ?>
	</div>
<?php get_footer(); ?>