<?php
/**
 * The sidebar containing the main widget area
 * 
 * @subpackage Education Insight
 * @since 1.0
 */
?>

<div  class="sidebar wow zoomInUp delay-1000<?php if( get_theme_mod( 'education_insight_sticky_sidebar', false) == 1) { ?> sidebar-sticky"data-wow-duration="2s"<?php } else { ?>close-sticky <?php } ?>">
    <div id="sidebar"  <?php if( is_page_template('blog-post-left-sidebar.php')){?> style="float:left;"<?php } ?>> 
        <?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>   
        <aside class="widget-area" role="complementary">
                <div id="search" class="widget widget_search wow zoomIn">
                    <h3 class="widget-title"><?php esc_html_e( 'Search', 'education-insight' ); ?></h3>
                    <?php get_search_form(); ?>
                </div>
                <div id="recent-posts" class="widget widget_recent_entries wow zoomIn">
                    <h3 class="widget-title"><?php esc_html_e( 'Recent Posts', 'education-insight' ); ?></h3>
                    <ul>
                        <?php
                            $recent_posts = wp_get_recent_posts(array('numberposts' => 5));
                            foreach( $recent_posts as $recent ){
                                echo '<li><a href="' . get_permalink($recent["ID"]) . '">' .   esc_html($recent["post_title"]) . '</a></li>';
                            }
                        ?>
                    </ul>
                </div>
            <?php endif; ?>
        </aside>
    </div>
</div>