<?php
/**
 * The sidebar containing the main widget area
 * 
 * @subpackage Adventure Trekking Camp
 * @since 1.0
 */
?>

<div  class="sidebar wow zoomInUp delay-1000<?php if( get_theme_mod( 'adventure_trekking_camp_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', 'adventure-trekking-camp' ); ?></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', 'adventure-trekking-camp' ); ?></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>