<?php
/**
 * Template Name: Homepage Pre-Built
 * @package Ultra WordPress Theme
 * @since 1.0
 * @author AJ Clarke : http://wpexplorer.com
 * @copyright Copyright (c) 2012, AJ Clarke
 * @link http://wpexplorer.com
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 */

get_header(); // Loads the header.php template

if ( of_get_option('home_slider','') !== '' ) { ?>
	<div id="page-slider">
		<?php echo do_shortcode( of_get_option('home_slider') ); ?>
	</div><!-- /page-slider -->
<?php } ?>

<div id="home-page-content" class="homepage-prebuilt-main clearfix boxed">
    <div class="entry clearfix fitvids">
    
	<?php while ( have_posts() ) : the_post(); ?>
    	<?php if ( $post->post_content !== "" ) { ?>
            <div id="home-content" class="clearfix">
                <?php the_content(); ?>
            </div><!-- #home-content -->
        <?php } ?>
	<?php endwhile; ?>
    
        <?php
        // Tagline
        if ( of_get_option('home_tagline','') !== ''
				&& of_get_option('home_tagline_enable','1') =='1' ) { ?>
            <!-- Tagline -->
            <div id="home-pb-tagline" class="clearfix">
				<?php echo apply_filters( 'the_content', of_get_option( 'home_tagline','' ) ); ?>
            </div><!-- #"home-pb-tagline -->            
            <hr class="symple-divider fadeout" />
        <?php } else { 
			//add some spacing at the top of your homepage since the tagline is disabled
			echo '<hr class="homepage-top-spacing" style="background:none;height:50px;margin:0;" />';
		} ?>
  
        <?php
		/*** Services ***/
		if ( class_exists( 'Symple_Services_Post_Type' )
			&& of_get_option('home_services_enable','1') == '1' ) { ?>
        	<!-- Services -->
            <div id="home-pb-services">
                <?php
                // Title
                if ( of_get_option('home_services_title','disable' ) !== 'disable' ) { ?>
                <h2 class="home-pb-heading symple-heading lined text-align-left">
                    <?php if ( of_get_option('home_services_title') !== '' ) {
                            echo '<span>'. of_get_option('home_services_title') .'</span>';
                        } else { 
                            echo '<span>'. __('Our Services','wpex') .'</span>';
                        } ?>
                </h2>
                <?php }
                // Services Output
                $home_services_category = ( of_get_option('home_services_category','All') !== 'All' ) ? of_get_option('home_services_category') : NULL;
                echo do_shortcode('[symple_services
                                        count="'. of_get_option('home_services_count','6') .'"
                                        columns="'. of_get_option('home_services_columns','3') .'"
                                        category_id="'. $home_services_category .'"
                                    ]');
                $home_services_cat = NULL; // Reset var ?>
                <hr class="home-pb-spacer" />
            </div><!-- #home-pb-services -->
        <?php } ?>

        <?php
		/*** Portfolio ***/
		if ( class_exists( 'Symple_Portfolio_Post_Type' )
			&& of_get_option('home_portfolio_enable','1') == '1' ) { ?>
        	<!-- Portfolio -->
            <div id="home-pb-portfolio">
				<?php
                // Title
                if ( of_get_option('home_portfolio_title','' ) !== 'disable' ) { ?>
                <h2 class="home-pb-heading symple-heading lined text-align-left">
                    <?php if ( of_get_option('home_portfolio_title') !== '' ) {
                            echo '<span>'. of_get_option('home_portfolio_title') .'</span>';
                        } else { 
                            echo '<span>'. __('Recent Work','wpex') .'</span>';
                        } ?>
                </h2>
                <?php }
                // Portfolio vars
                $home_portfolio_filter = ( of_get_option('home_portfolio_filter','false')  == 'true' ) ? 'category' : $home_portfolio_filter = NULL;
                $home_portfolio_category = ( of_get_option('home_portfolio_category','All') !== 'All' ) ? of_get_option('home_portfolio_category') : NULL;
                
                // Portfolio Output
                if ( of_get_option('home_portfolio_count','4') !== '' && of_get_option('home_portfolio_count','4') !== '0' ) {
                    echo do_shortcode('
                            [symple_portfolio
                                count="'. of_get_option('home_portfolio_count','8') .'"
                                columns="'. of_get_option('home_portfolio_columns','4') .'"
                                filter="'. $home_portfolio_filter .'"
                                title="'. of_get_option('home_portfolio_entry_title','false') .'"
                                excerpt="'. of_get_option('home_portfolio_entry_excerpt','false') .'"
                                excerpt_length="'.of_get_option('home_portfolio_excerpt_length','15') .'"
                                read_more="'. of_get_option('home_portfolio_entry_readmore','false') .'"
                                lightbox_only="'. of_get_option('home_portfolio_lightbox_only','false') .'"
                                category_id="'. $home_portfolio_category .'"
								thumbnail_height="'.of_get_option('home_portfolio_thumbail_height','300') .'"
                            ]');
                }
                $home_portfolio_filter = $home_portfolio_category = NULL; // clear var ?>
                <hr class="home-pb-spacer" />
            </div><!-- home-pb-portfolio -->
        <?php } ?>
        
        <!-- Recent News & Testimonials -->
        <div id="home-pb-blog-testimonials" class="clearfix">
        
        	<!-- Recent News -->
            <?php if ( of_get_option('home_blog_enable','1') == '1' ) { ?>
            <div id="home-pb-blog" class="<?php if( of_get_option('home_blog_float','1') == '1' ) echo 'symple-column symple-one-half'; ?>">
                <?php
                // Title
                if ( of_get_option('home_blog_title','' ) !== 'disable' ) { ?>
                <h2 class="home-pb-heading symple-heading lined text-align-left">
                    <?php if ( of_get_option('home_blog_title') !== '' ) {
                            echo '<span>'. of_get_option('home_blog_title') .'</span>';
                        } else { 
                            echo '<span>'. __('Recent News','wpex') .'</span>';
                        } ?>
                </h2>
                <?php }
                // Recent blog posts vars
                $home_blog_category = ( of_get_option('home_blog_category','All') !== 'All' ) ? of_get_option('home_blog_category') : NULL;
                
                // Recent blog posts output
                echo do_shortcode('[symple_blog
                                        
                                        count="'.of_get_option('home_blog_count','2') .'"
                                        columns="'.of_get_option('home_blog_columns','1') .'"
                                        excerpt_length="'.of_get_option('home_blog_excerpt_length','15') .'"
                                        category_id="'. $home_blog_category .'"
                                    ]'); ?>
                
             </div><!-- home-pb-portfolio -->
             <?php } ?>
             
             
            <!-- Testimonials -->
            <?php if ( of_get_option('home_testimonials_enable','1') == '1' ) { ?>
            <div id="home-pb-testimonials" class="<?php if( of_get_option('home_blog_float','1') == '1' ) echo 'symple-column symple-one-half remove-margin'; ?>">
            	<h2 class="home-pb-heading symple-heading lined text-align-left">
                    <?php
                    // Title
                	if ( of_get_option('home_testimonials_title','' ) !== 'disable' ) {
						if ( of_get_option('home_testimonials_title', '') !== '' ) {
                            echo '<span>'. of_get_option('home_testimonials_title') .'</span>';
                        } else { 
                            echo '<span>'. __('Testimonials','wpex') .'</span>';
                        }
					} ?>
                </h2>
            	<?php echo do_shortcode('[symple_testimonials count="4" excerpt="true"]'); ?>
            </div><!-- #home-pb-testimonials -->
            <?php } ?>
        
        <hr class="home-pb-spacer" />
        </div><!-- #home-pb-blog-testimonials -->
     
    </div><!-- /entry -->
    
</div><!-- /home-page-content -->

<?php get_footer(); // Loads the footer.php file