function vc_widget_func($atts, $content = null) { extract(shortcode_atts(array('post_type' => '', 'image_size' => '', 'carousel' => '', 'carousel_autoheight' => '', 'carousel_margin' => '', 'carousel_navi' => '', 'carousel_dots_navi' => '', 'carousel_autoplay' => '', 'carousel_autoplaytimeout' => '', 'carousel_autoplayhoverpause' => '', 'carousel_loop' => '', 'columns' => '', 'items' => '', 'cat_filter' => '', 'thumbnails' => '', 'caption' => '', 'order' => '', 'orderby' => ''), $atts)); if (empty($post_type)) { $post_type = 'post'; } if (empty($image_size)) { $image_size = 'theme-size-3x2'; } if (empty($columns)) { $columns = '3'; } if (empty($orderby)) { $orderby = 'date'; } if (empty($order)) { $order = 'DESC'; } if ($post_type == "post") { $post_type = "post"; $cat_terms = "category"; } else { $post_type = "portfolio"; $cat_terms = "portfolio_category"; } if ($items) { $posts_per_page = '&posts_per_page=' . $items . ''; } else { $posts_per_page = '&posts_per_page=-1'; } if ($post_type == "portfolio") { $category_filter = '&portfolio_category=' . $cat_filter; } else { $category_filter = '&category_name=' . $cat_filter; } if ($carousel) { if ($columns == "3") { $columns = "4"; } elseif ($columns == "4") { $columns = "3"; } elseif ($columns == "6") { $columns = "2"; } global $shortcode_atts; $shortcode_atts = array('carousel_autoheight' => $carousel_autoheight, 'carousel_margin' => $carousel_margin, 'carousel_navi' => $carousel_navi, 'carousel_dots_navi' => $carousel_dots_navi, 'carousel_autoplay' => $carousel_autoplay, 'carousel_autoplaytimeout' => $carousel_autoplaytimeout, 'carousel_autoplayhoverpause' => $carousel_autoplayhoverpause, 'carousel_loop' => $carousel_loop, 'columns' => $columns); lpd_owl_carousel(); global $the_post_widget_ID; $the_post_widget_ID = rand(); } ob_start(); ?> <div class="post-widget"> <div class="row"> <?php if ($carousel) { ?> <div class="col-md-12 owl-carousel-<?php echo esc_attr($the_post_widget_ID); ?> "><?php } ?> <?php $query = new WP_Query(); ?> <?php $query->query('post_type=' . $post_type . '' . $posts_per_page . '' . $category_filter . '&orderby=' . $orderby . '&order=' . $order . ''); ?> <?php if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); ?> <?php $video = lpd_parse_video(get_post_meta(get_the_ID(), 'video_post_meta', true)); ?> <?php $link = get_post_meta(get_the_ID(), 'link_post_meta', true); ?> <?php $gallery_type = get_post_meta(get_the_ID(), 'portfolio_options_select', true); ?> <?php $terms = get_the_terms(get_the_ID(), $cat_terms); ?> <?php if ($post_type == "portfolio") { ?> <?php $header_image = wp_get_attachment_image_src(get_post_meta(get_the_ID(), 'portfolio_header_image', true), $image_size); ?> <?php } else { ?> <?php $header_image = wp_get_attachment_image_src(get_post_meta(get_the_ID(), 'post_header_image', true), $image_size); ?> <?php } ?> <?php if (!$carousel) { ?> <div class="col-md-<?php echo esc_attr($columns); ?> "><?php } ?> <div class="lpd-post-widget"> <?php if (!$thumbnails) { ?> <?php if ($link) { ?> <?php if (has_post_thumbnail()) { ?> <a href="<?php echo esc_url($link); ?> " class="pw-thumbnail"> <img alt="<?php the_title(); ?> " class="img-responsive" src="<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $image_size); echo esc_url($image[0]); ?> "/> <span class="post-type-icon link"></span> </a> <?php } elseif ($header_image) { ?> <a href="<?php the_permalink(); ?> " class="pw-thumbnail"> <img alt="<?php the_title(); ?> " class="img-responsive" src="<?php echo esc_url($header_image[0]); ?> "/> <span class="post-type-icon link"></span> </a> <?php } else { ?> <a href="<?php echo esc_url($link); ?> " class="pw-thumbnail"> <img class="img-responsive" alt="<?php the_title(); ?> " src="<?php echo THEME_ASSETS; ?> img/no-image.png"/> <span class="post-type-icon link"></span> </a> <?php } ?> <?php } elseif ($video) { ?> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> " class="pw-thumbnail"> <img alt="<?php the_title(); ?> " class="img-responsive" src="<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $image_size); echo esc_url($image[0]); ?> "/> <span class="post-type-icon video"></span> </a> <?php } elseif ($header_image) { ?> <a href="<?php the_permalink(); ?> " class="pw-thumbnail"> <img alt="<?php the_title(); ?> " class="img-responsive" src="<?php echo esc_url($header_image[0]); ?> "/> <span class="post-type-icon video"></span> </a> <?php } else { ?> <a href="<?php the_permalink(); ?> " class="pw-thumbnail"> <img class="img-responsive" alt="<?php the_title(); ?> " src="<?php echo THEME_ASSETS; ?> img/no-image.png"/> <span class="post-type-icon video"></span> </a> <?php } ?> <?php } elseif (function_exists('has_post_thumbnail') && has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> " class="pw-thumbnail"> <?php if (function_exists('has_post_thumbnail') && has_post_thumbnail()) { ?> <img alt="<?php the_title(); ?> " class="img-responsive" src="<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), $image_size); echo esc_url($image[0]); ?> "/> <span class="post-type-icon"></span> <?php } ?> </a> <?php } else { ?> <?php if ($header_image) { ?> <a href="<?php the_permalink(); ?> " class="pw-thumbnail"> <img alt="<?php the_title(); ?> " class="img-responsive" src="<?php echo esc_url($header_image[0]); ?> "/> <span class="post-type-icon"></span> </a> <?php } else { ?> <a href="<?php the_permalink(); ?> " class="pw-thumbnail"> <img class="img-responsive" alt="<?php the_title(); ?> " src="<?php echo THEME_ASSETS; ?> img/no-image.png"/> <span class="post-type-icon"></span> </a> <?php } ?> <?php } ?> <?php } ?> <div class="widget-meta"> <div class="ribbon"><span class="ribbon-content"></span></div> <table> <tbody> <tr> <td class="pw-author"><a href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID'))); ?> " class="author"><?php echo esc_html(get_the_author()); ?> </a></td> <?php if ($terms) { ?> <td class="pw-category"> <?php $resultstr = array(); ?> <?php if ($terms) { foreach ($terms as $term) { ?> <?php $resultstr[] = '<a title="' . esc_attr($term->name) . '" href="' . esc_url(get_term_link($term->slug, $cat_terms)) . '">' . esc_html($term->name) . '</a>'; ?> <?php } ?> <?php echo $resultstr[0]; } ?> </td><?php } ?> <td class="pw-date"><a href="<?php echo esc_url(get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d'))); ?> " class="date"><?php the_time('M j, Y'); ?> </a></td> </tr> </tbody> </table> </div> <div class="content<?php if ($thumbnails) { ?> no-thumbnail<?php } ?> "> <?php if ($link) { ?> <h4 class="title lpd-animated-link"><a href="<?php echo esc_url($link); ?> "><?php the_title(); ?> </a></h4> <?php } else { ?> <h4 class="title lpd-animated-link"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h4> <?php } ?> <?php if (!$caption) { ?> <div class="lpd-post-widget-content"> <p><?php echo lpd_excerpt(15); ?> </p> </div> <?php } ?> <div class="lpd-post-widget-element"></div> </div> </div> <?php if (!$carousel) { ?> </div><?php } ?> <?php } } wp_reset_query(); ?> <?php if ($carousel) { ?> </div><?php } ?> </div> </div> <?php if ($carousel) { $counter_js = new post_widget_class(); $counter_js->post_widget_callback(); } ?> <?php return ob_get_clean(); }
<?php $st_buttons = ot_get_option('st_buttons'); ?> <?php $video = lpd_parse_video(get_post_meta($post->ID, 'video_post_meta', true)); $blog_post_a_type = ot_get_option('blog_post_a_type'); $blog_post_a_speed = ot_get_option('blog_post_a_speed'); $blog_post_a_delay = ot_get_option('blog_post_a_delay'); $blog_post_a_offset = ot_get_option('blog_post_a_offset'); $blog_post_a_easing = ot_get_option('blog_post_a_easing'); if (!$blog_post_a_speed) { $blog_post_a_speed = '1000'; } if (!$blog_post_a_delay) { $blog_post_a_delay = '0'; } if (!$blog_post_a_offset) { $blog_post_a_offset = '80'; } $animation_att = ' data-animation="' . esc_attr($blog_post_a_type) . '" data-speed="' . esc_attr($blog_post_a_speed) . '" data-delay="' . esc_attr($blog_post_a_delay) . '" data-offset="' . esc_attr($blog_post_a_offset) . '" data-easing="' . esc_attr($blog_post_a_easing) . '"'; ?> <div id="post-<?php the_ID(); ?> " class="single-post <?php $allClasses = get_post_class(); foreach ($allClasses as $class) { echo esc_attr($class) . " ";