<?php if ($effects){
    $cr_effect = ' cr-animate-gen"  data-gen="'.$effects.'" data-gen-offset="bottom-in-view';
} else {
    $cr_effect ='';
} ?>

<div class="module recent-block" id="<?php echo $unique_id ?>">
    <?php if ($main_title != ''): ?>
        <h3 class="widget-title">
            <?php echo $main_title ?>

            <span class="extra-links"></span>
        </h3>
    <?php else: ?>
	<div class="widget-title">
		<span class="extra-links"></span>
	</div>
	<?php endif;?>

   <div class="news-row ">
	<?php
    $the_query = null;
    $sticky = get_option( 'sticky_posts' );

    if ($categories){
        $args = array(
            'category__in' => explode(',', $categories),
            'posts_per_page' => $all_of_posts,
            'ignore_sticky_posts' => 1,
            'post__not_in' => $sticky,
        );
    } else {
        $args = array(
            'posts_per_page' => $all_of_posts,
            'ignore_sticky_posts' => 1,
            'post__not_in' => $sticky,
        );
    }

    $the_query = new WP_Query($args);
    while ($the_query->have_posts()) :
        $the_query->the_post();      ?>

        <div class="<?php echo $column_number ?> columns item <?php echo $cr_effect; ?>">
            <article class="hnews hentry">

                <?php

                if (has_post_thumbnail()) {

                    $thumb = get_post_thumbnail_id();
                    $img_url = wp_get_attachment_url($thumb, 'medium'); //get img URL
                    $article_image = aq_resize($img_url, 460, 380, true);

                    ?>

                    <div class="entry-thumb">


                        <img src="<?php echo $article_image ?>" alt="<?php the_title(); ?>"/>


                        <a href="<?php the_permalink(); ?>" class="link"></a>

	                    <?php if ($display_comments):?>
	                    <a href="<?php get_comments_link(); ?>" class="mini-comm-count">
                            <?php comments_number('0', '1', '%'); ?>
                        </a>
	                    <?php endif;?>

                    </div>

                <?php } ?>

                <?php if ($display_title):?>
	            <div class="box-name">
                    <a href="<?php the_permalink(); ?>">
                        <?php the_title(); ?>
                    </a>
                </div>
				<?php endif;?>

	            <?php if ($display_meta):?>
                <div class="dopinfo">
                    <?php get_template_part('templates/entry-meta', 'mini'); ?>
                </div>
	            <?php endif;?>


                <?php if ($excerpt): ?>

                    <div class="entry-summary">

                        <p><?php echo mvb_wordwrap(get_the_excerpt(), $excerpt_length); ?></p>

                    </div>

                <?php endif; ?>

            </article>
        </div>

    <?php endwhile;
    wp_reset_query(); ?>




</div>
<script type="text/javascript">
	jQuery(document).ready(function () {

		var item_width;

		var news_row = jQuery('#<?php echo $unique_id ?>');

		item_width = (news_row.find('.item').width())-'3';

		jQuery('#<?php echo $unique_id ?>').flexslider({
			selector: ".news-row > .item",
			namespace: "posts-",          //{NEW} String: Prefix string attached to the class of every element generated by the plugin
			animation: "slide",
			direction: "horizontal",
			itemWidth: item_width,                   //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
			itemMargin: 3,                  //{NEW} Integer: Margin between carousel items.
			minItems: 1,                    //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
			maxItems: <?php echo $no_of_posts; ?>,
			slideshow: false,
			controlsContainer: jQuery('#<?php echo $unique_id ?>').find(".extra-links"),
			controlNav: false,               //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
			directionNav: true,           //Boolean: Create navigation for previous/next navigation? (true/false)
			prevText: "",                 //String: Set the text for the "previous" directionNav item
			nextText: ""
		});

	});
</script>
</div>