function my_search()
{
    $term = strtolower($_GET['term']);
    $suggestions = array();
    $loop = new WP_Query('s=' . $term);
    if ($loop->have_posts()) {
        while ($loop->have_posts()) {
            $loop->the_post();
            $suggestion = array();
            $thumb = get_post_thumbnail_id();
            $img_url = wp_get_attachment_url($thumb, 'full');
            $image = zl_theme_thumb($img_url, 80, 80, 'c', false);
            $suggestion['label'] = get_the_title();
            $suggestion['link'] = get_permalink();
            $suggestion['desc'] = get_the_excerpt();
            /*if($image){
            			$suggestion['thumb'] = $image;
            		} else {
            			$suggestion['thumb'] = 'http://placehold.it/100x100/000000/000000';
            		}*/
            $suggestion['thumb'] = $image;
            $suggestions[] = $suggestion;
        }
    } else {
        $suggestion['label'] = 'There are no keyword of "' . $term . '"';
        $suggestion['link'] = '?s=' . $term;
        $suggestion['desc'] = 'Please try with different keyword';
        $suggestions[] = $suggestion;
    }
    wp_reset_query();
    $response = json_encode($suggestions);
    echo $response;
    exit;
}
                    echo "<div>";
                    echo wp_oembed_get($media);
                    echo "</div>";
                }
            }
        }
        ?>
                    <?php 
    }
    //End foreach $galls
    ?>
                </div>

            <?php 
} else {
    $thumb = zl_theme_thumb($img_url, 960, null, 't', false);
    ?>
                 <img src="<?php 
    echo $thumb;
    ?>
"/>
            <?php 
}
// End if;
?>
            <div class="clear"></div>
        </div>
        <!-- END IMage and Media -->
    </div>

    <!-- ooooooooooooooooooooooooooooooooooooooooooo
					</div>
					<div class="row">
						<div class="portfolioContainer">
							<?php 
global $wp_query;
$args = array('post_type' => 'zl_portfolio', 'post_status' => 'publish', 'orderby' => 'DATE', 'order' => 'DESC', 'paged' => $pageds, 'posts_per_page' => -1, 'ignore_sticky_posts' => 1);
$porto = new WP_Query($args);
?>
							<?php 
if ($porto->have_posts()) {
    while ($porto->have_posts()) {
        $porto->the_post();
        //Let's Generate the Thumbnail.
        $thumb = get_post_thumbnail_id();
        $img_url = wp_get_attachment_url($thumb, 'full');
        $image = zl_theme_thumb($img_url, 500, 400, 'c', true);
        $terms = get_the_terms(get_the_ID(), 'project_types');
        ?>
								<!-- Portfolio Loop -->
								<div class="zl_porto_itemwrap large-6 column <?php 
        foreach ($terms as $term) {
            echo $term->slug . ' ';
        }
        ?>
">
									<div class="zl_porto_inner">
										<?php 
        if ($image) {
            echo '<img src="' . $image . '" alt="' . get_the_title() . '" />';
        }
        ?>
if ($album->have_posts()) {
    while ($album->have_posts()) {
        $album->the_post();
        //Let's Generate the Thumbnail.
        $thumb = get_post_thumbnail_id();
        $img_url = wp_get_attachment_url($thumb, 'full');
        $image = zl_theme_thumb($img_url, 300, 300, 'c', true);
        //Define Gallery Images
        $gallery = get_post_gallery_images();
        //Count Items
        $items = count($gallery);
        //Get First Item if featured image isn't set.
        $firstimg = reset($gallery);
        $firstimg = str_replace('-150x150', '', $firstimg);
        //Crop the first image.
        $firstimg = zl_theme_thumb($firstimg, 300, 300, 'c', true);
        ?>
								<!-- Album Loop -->
								<div class="zl_album_parent large-4 column">
									<div class="zl_album" data-albumlink='<?php 
        the_permalink();
        ?>
' data-albumid="<?php 
        the_ID();
        ?>
">
										<div class="zl_albumthumb">
											<?php 
        if ($image) {
            echo '<img src="' . $image . '" alt="' . get_the_title() . '" />';
        } else {
    /**
     * Outputs the HTML for this widget.
     *
     * @param array  An array of standard parameters for widgets in this theme
     * @param array  An array of settings for this widget instance
     * @return void Echoes it's output
     **/
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $fetch = empty($instance['fetch']) ? ' ' : apply_filters('widget_title', $instance['fetch']);
        echo $before_widget;
        echo $before_title;
        echo $title;
        // Can set this with a widget option, or omit altogether
        echo $after_title;
        //
        // Widget display logic goes here
        //
        /*oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*/
        /* Here We Go, BUild the Gate to prevent headache to find out which the Output*/
        /*oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*/
        ?>
    <div class="row albwidget">
    <?php 
        global $wp_query;
        $args = array('post_type' => 'zl_album', 'post_status' => 'publish', 'orderby' => 'DATE', 'order' => 'DESC', 'posts_per_page' => $fetch, 'ignore_sticky_posts' => 1);
        $album = new WP_Query($args);
        ?>
    <?php 
        if ($album->have_posts()) {
            while ($album->have_posts()) {
                $album->the_post();
                //Let's Generate the Thumbnail.
                $thumb = get_post_thumbnail_id();
                $img_url = wp_get_attachment_url($thumb, 'full');
                $image = zl_theme_thumb($img_url, 100, 100, 'c', true);
                //Get Gallery Images
                $gallery = get_post_gallery_images();
                //Count Images
                $items = count($gallery);
                //Get the First Item if featured image isn't set.
                $firstimg = reset($gallery);
                $firstimg = str_replace('-150x150', '', $firstimg);
                //Crop the first image.
                $firstimg = zl_theme_thumb($firstimg, 100, 100, 'c', true);
                ?>
        <!-- Album Loop -->
        <div class="small-4 column tooltip" title="<?php 
                the_title();
                ?>
 | <?php 
                echo $items . zl_option('lang_photos', __(' Photos', 'zatolab'));
                ?>
">
            <div class="zl_alb_wid" title="<?php 
                the_title();
                ?>
 | <?php 
                echo $items . zl_option('lang_photos', __(' Photos', 'zatolab'));
                ?>
">
                <div data-albumlink='<?php 
                the_permalink();
                ?>
' data-albumid="album-<?php 
                the_ID();
                ?>
">
                    <a href="<?php 
                the_permalink();
                ?>
" class="abs">&nbsp;</a>
                    <a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
">
                    <?php 
                if ($image) {
                    echo '<img src="' . $image . '" alt="' . get_the_title() . '" />';
                } else {
                    echo '<img src="' . $firstimg . '" alt="' . get_the_title() . '" />';
                }
                ?>
                    </a>
                </div>
            </div>
        </div><!-- // .zl_album_parent large-3 Album Loop -->
    <?php 
            }
        }
        ?>
    </div>
<?php 
        /*oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*/
        /* </END of: Here We Go, BUild the Gate to prevent headache to find out which the Output*>
        /*oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*/
        echo $after_widget;
    }
    ?>
					 <a><span class="dashicons dashicons-arrow-right-alt2"></span></a>
				</div>
				<div class="alb_navig text-center">
					<div class="dashicons dashicons-screenoptions"></div>
				</div>

				<div class="alb_thumbnails">
					<div class="dashicons dashicons-no-alt close_su"></div>
					<div class="owl-carousel albthumb">
					<?php 
    if ($photos) {
        $i = 0;
        foreach ($photos as $id) {
            $attimgurl = wp_get_attachment_url($id, 'full');
            $imgsrc = zl_theme_thumb($attimgurl, 80, 80, 'c', true);
            //Output
            $aresame = null;
            if (get_the_ID() == $id) {
                $aresame = 'iscurrent';
            }
            echo '<a href="' . get_attachment_link($id) . '" title="' . get_the_title($id) . '" data-id="' . $id . '" class="' . $aresame . '"><img src="' . $imgsrc . '" alt="' . get_the_title($id) . '" /></a>';
            $i++;
        }
        // end foreach
    }
    //endif
    ?>
				 	</div> <!-- End .albthumb -->
				</div> <!-- End .alb_thumbnails -->
				<?php 
    wp_reset_postdata();
    ?>
			</div>

			<!-- COL 3 -->
			<div class="zl_gal_col3">
				<?php 
    $args = array('post_type' => 'post', 'cat' => $featured_cats, 'posts_per_page' => 2, 'orderby' => 'DATE', 'ignore_sticky_posts ' => 1, 'offset' => 3);
    $featured = new WP_Query($args);
    if ($featured->have_posts()) {
        while ($featured->have_posts()) {
            $featured->the_post();
            /* Featured Image */
            $thumb = get_post_thumbnail_id();
            $img_url = wp_get_attachment_url($thumb, 'full');
            $image = zl_theme_thumb($img_url, 250, 250, 'c', true);
            ?>
				<!-- Featured Post -->
				<div class="zl_gal_inner">
					<a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
" class="zl_featlink">&nbsp;</a>
					<?php 
            if ($image) {
                ?>
						<img src="<?php 
                echo $image;
if ($album->have_posts()) {
    while ($album->have_posts()) {
        $album->the_post();
        //Let's Generate the Thumbnail.
        $thumb = get_post_thumbnail_id();
        $img_url = wp_get_attachment_url($thumb, 'full');
        $image = zl_theme_thumb($img_url, 225, 225, 'c', true);
        //Define Gallery Images
        $gallery = get_post_gallery_images();
        //Count Items
        $items = count($gallery);
        //Get First Item if featured image isn't set.
        $firstimg = reset($gallery);
        $firstimg = str_replace('-150x150', '', $firstimg);
        //Crop the first image.
        $firstimg = zl_theme_thumb($firstimg, 225, 225, 'c', true);
        ?>
									<!-- Album Loop -->
									<div class="zl_album_parent medium-3 column">
										<div class="zl_album" data-albumlink='<?php 
        the_permalink();
        ?>
' data-albumid="<?php 
        the_ID();
        ?>
">
											<div class="zl_albumthumb">
												<?php 
        if ($image) {
            echo '<img src="' . $image . '" alt="' . get_the_title() . '" />';
        } else {
    $cats = implode(',', $cats);
}
$slides = new WP_Query(array('orderby' => $orderby, 'order' => 'DESC', 'post_type' => 'post', 'posts_per_page' => zl_option('slider_fetch', '3'), 'meta_key' => 'wpb_post_views_count', 'cat' => $cats));
?>
				
			<?php 
if ($slides->have_posts()) {
    while ($slides->have_posts()) {
        $slides->the_post();
        //Thumb Generate
        $thumb = get_post_thumbnail_id();
        $img_url = wp_get_attachment_url($thumb, 'full');
        if (wp_is_mobile()) {
            $image = zl_theme_thumb($img_url, 370, 200, 'c', true);
        } else {
            $image = zl_theme_thumb($img_url, 370, 200, 'c', true);
        }
        $spec_cond = zl_postformat();
        ?>
			<div class="item large-12 columns">
				<div class="zl_carou_thumb">
					<?php 
        if ($image) {
            ?>
						<a href="<?php 
            the_permalink();
            ?>
" rel="bookmark" title="<?php 
            echo __('Permanent Link to', 'envalabs');
            ?>
 <?php 
					</div>
					<div class="row">
						<div class="portfolioContainer">
							<?php 
global $wp_query;
$args = array('post_type' => 'zl_portfolio', 'post_status' => 'publish', 'orderby' => 'DATE', 'order' => 'DESC', 'paged' => $pageds, 'posts_per_page' => -1, 'ignore_sticky_posts' => 1);
$porto = new WP_Query($args);
?>
							<?php 
if ($porto->have_posts()) {
    while ($porto->have_posts()) {
        $porto->the_post();
        //Let's Generate the Thumbnail.
        $thumb = get_post_thumbnail_id();
        $img_url = wp_get_attachment_url($thumb, 'full');
        $image = zl_theme_thumb($img_url, 327, 327, 'c', true);
        $terms = get_the_terms(get_the_ID(), 'project_types');
        ?>
								<!-- Portfolio Loop -->
								<div class="zl_porto_itemwrap large-4 column <?php 
        foreach ($terms as $term) {
            echo $term->slug . ' ';
        }
        ?>
">
									<div class="zl_porto_inner">
										<?php 
        if ($image) {
            echo '<img src="' . $image . '" alt="' . get_the_title() . '" />';
        }
        ?>
                        $height = '240';
                    }
                }
            }
        }
        ?>
			<div class="zl_square-grid<?php 
        echo $layout;
        ?>
">
				<?php 
        if ($galls) {
            $i = 0;
            foreach ($galls as $gall) {
                $thumbnail = wp_get_attachment_image_src($gall, 'full');
                $small = zl_theme_thumb($thumbnail[0], $height, $height, 'c');
                echo '<a href="' . $thumbnail[0] . '" class="plainzoom" rel="prettyPhoto[pp_gal_' . get_the_id() . ']">' . "\n";
                echo '<img src="' . $small . '" alt="' . get_the_title() . 'gall-' . $i . '"/>' . "\n";
                echo '</a>' . "\n";
                $i++;
            }
            //End foreach;
        }
        //endif $galls;
        ?>
			</div>
			<?php 
    }
}
// END if( 'grid' == $type)
?>
<?php

$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_url($thumb, 'full');
$image = zl_theme_thumb($img_url, 960, null, 'c', true);
?>


<article <?php 
post_class('post');
?>
 itemscope itemtype="http://schema.org/Article" id="post-<?php 
the_ID();
?>
">
	
	<div class="zl_loop">
		<header class="pg_ttl_hdr">
			<h1 class="entry-title text-center"><?php 
the_title();
?>
</h1>
		</header>
		<div class="zl_post_detail">
			<div class="row">
				<!-- Detail -->
				<div class="large-12 column conentry">
					
					<?php 
the_content();
?>
		<!-- pagination -->
		<div class="large-12 column">
			<h2 class="fword"><?php 
            echo zl_option('lang_related', __('Related Articles', 'zatolab'));
            ?>
</h2>
		</div>
		<div class="clear"></div>
		<?php 
            // The Loop
            while ($my_query->have_posts()) {
                $my_query->the_post();
                //Thumb Generate
                $thumb = get_post_thumbnail_id();
                $img_url = wp_get_attachment_url($thumb, 'full');
                $image = zl_theme_thumb($img_url, 300, 200, 't', true);
                ?>
		<div <?php 
                post_class('medium-4 column');
                ?>
 itemscope itemtype="http://schema.org/Article" id="post-<?php 
                the_ID();
                ?>
">
			<div class="zl_related_thumb">
				<?php 
                if (!empty($image)) {
                    ?>
					<img itemprop="image" class="entry-thumb" src="<?php 
                    echo $image;
                    ?>
									</div>
									<div class="clear"></div>
								</div>
							<?php 
            }
            ?>
							</div>

						<?php 
        } else {
            ?>
							<div class="swipeboxEx">
								<?php 
            foreach ($photos as $photo) {
                $attimgurl = wp_get_attachment_url($photo, 'full');
                $imgsrc = zl_theme_thumb($attimgurl, null, 150, 'c', true);
                //Output
                ?>
										<a href="<?php 
                echo get_attachment_link($photo);
                ?>
" class="zl_zoom">
											<img src="<?php 
                echo $imgsrc;
                ?>
" alt="<?php 
                echo get_the_title($photo);
                ?>
" />
										</a>
								<?php 
    /**
     * Outputs the HTML for this widget.
     *
     * @param array  An array of standard parameters for widgets in this theme
     * @param array  An array of settings for this widget instance
     * @return void Echoes it's output
     **/
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $fetch = empty($instance['fetch']) ? ' ' : apply_filters('widget_title', $instance['fetch']);
        echo $before_widget;
        echo $before_title;
        echo $title;
        // Can set this with a widget option, or omit altogether
        echo $after_title;
        //
        // Widget display logic goes here
        //
        /*oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*/
        /* Here We Go, BUild the Gate to prevent headache to find out which the Output*/
        /*oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*/
        ?>
   
	<?php 
        global $post;
        /**
         * The WordPress Query class.
         * @link http://codex.wordpress.org/Function_Reference/WP_Query
         *
         */
        $args = array('posts_per_page' => $fetch, 'ignore_sticky_posts' => 1);
        $recentposts = new WP_Query($args);
        if ($recentposts->have_posts()) {
            echo '<ul class="row zl_recentpost_widget">';
            while ($recentposts->have_posts()) {
                $recentposts->the_post();
                $thumb = get_post_thumbnail_id();
                $img_url = wp_get_attachment_url($thumb, 'full');
                $image = zl_theme_thumb($img_url, 50, 50, 'c', true);
                ?>
        <li>
            <div class="row">
                    <?php 
                if ($image) {
                    echo '<div class="small-3 columns">';
                    echo '<img src="' . $image . '" alt="' . get_the_title() . '"/>';
                    echo '</div>';
                    echo '<div class="small-9 column">';
                    echo '<div class="posttimestamp">';
                    echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago';
                    echo '</div>';
                    echo '<div class="clear"></div>';
                    echo '<a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '</a>';
                    echo '<div class="clear"></div>';
                    echo '</div>';
                } else {
                    echo '<div class="small-12 column">';
                    echo '<div class="posttimestamp">';
                    echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago';
                    echo '</div>';
                    echo '<div class="clear"></div>';
                    echo '<a href="' . get_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '</a>';
                    echo '<div class="clear"></div>';
                    echo '</div>';
                }
                ?>
                    <div class="clear"></div>
            </div>
        </li>
    <?php 
            }
            echo '</ul>';
        }
        wp_reset_query();
        ?>

<?php 
        /*oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*/
        /* </END of: Here We Go, BUild the Gate to prevent headache to find out which the Output*>
        /*oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo*/
        echo $after_widget;
    }
<?php

$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_url($thumb, 'full');
$image = zl_theme_thumb($img_url, 960, null, 'c', false);
?>

<!-- loop Item -->
<article <?php 
post_class('post');
?>
 itemscope itemtype="http://schema.org/Article" id="post-<?php 
the_ID();
?>
">
	<div class="zl_loop">
		<div class="zl_post_detail">
			
			<div class="row">
				<!-- Detail -->
				<div class="medium-9 column conentry">
					<div class="zl_post_icon">
						<div class="dashicons dashicons-format-status"></div>
					</div>
			
					<?php 
the_content('', '');
?>
				</div>
				
				<!-- Meta -->
<?php

$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_url($thumb, 'full');
$image = zl_theme_thumb($img_url, 960, 600, 'c', true);
?>

<!-- loop Item -->
<article <?php 
post_class('post');
?>
 itemscope itemtype="http://schema.org/Article" id="post-<?php 
the_ID();
?>
">
	<div class="zl_loop">
		<div class="zl_post_detail">
			<div class="row">
				<!-- Detail -->
				<div class="medium-9 column conentry">
					<div class="zl_post_icon">
						<div class="dashicons dashicons-format-status"></div>
					</div>
					
					<?php 
if (is_singular() || is_page()) {
    the_content('', '');
} else {
    the_content('', '');
}
?>
<article <?php 
post_class('post');
?>
 itemscope itemtype="http://schema.org/Article" id="post-<?php 
the_ID();
?>
">
	<div class="zl_loop">
		<!-- Thumb -->
		<div class="mediaplayer">
			<?php 
$video = get_post_meta($post->ID, '_format_video_embed', true);
$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_url($thumb, 'full');
$image = zl_theme_thumb($img_url, 960, 600, 'c', false);
$media = $video;
$type = wp_check_filetype($media);
if ($img_url) {
    if (strstr($type['type'], "video/")) {
        echo do_shortcode('[video src="' . $media . '" poster="' . $img_url . '" ]');
    } else {
        ?>
	                	<div class="videothumb">
							<a class="oembedtrigger">
								<img src="<?php 
        echo $image;
        ?>
" alt="<?php 
        the_title();
        ?>
"/>