function ts_person_details_func($atts, $content = null) { extract(shortcode_atts(array("id" => 0, 'header' => ''), $atts)); global $post; $new_post = null; if (!empty($id)) { $new_post = get_post($id); } if ($new_post) { $old_post = $post; $post = $new_post; $image = ''; if (has_post_thumbnail($post->ID, 'post')) { $image = ts_get_resized_post_thumbnail($post->ID, 'person-thumb'); } $facebook = get_post_meta($post->ID, 'facebook_url', true); $twitter = get_post_meta($post->ID, 'twitter_url', true); $skype = get_post_meta($post->ID, 'skype_username', true); $content = stripslashes($post->post_content); $skills = get_post_meta($post->ID, 'skills', true); $skills_html = ''; if (is_array($skills)) { foreach ($skills as $skill) { $skills_html .= '<div><span style="width:' . $skill['percentage'] . '%">' . $skill['title'] . '</span></div>'; } } $html = ' <section class="container personal-details"> <h2 class="title">' . $header . '</h2> <div class="separator"> <div></div> </div> <div class="member-details"> <div class="grid_6 member-info"> ' . $image . ' <h2>' . get_the_title($post->ID) . '</h2> <span>' . get_post_meta($post->ID, 'team_position', true) . '</span> <p class="description">' . get_post_meta($post->ID, 'short_description', true) . '</p> ' . do_shortcode($content) . ' </div> <div class="grid_6"> <div class="member-social"> ' . (!empty($facebook) ? '<a class="facebook" href="' . $facebook . '" target="_blank" title="Facebook"></a>' : '') . ' ' . (!empty($twitter) ? '<a class="twitter" href="' . $twitter . '" target="_blank" title="Twitter"></a>' : '') . ' ' . (!empty($skype) ? '<a class="skype" href="skype:' . $skype . '?call" title="Skype"></a>' : '') . ' </div> <div class="member-skills"> ' . $skills_html . ' </div> </div> </div> </section>'; $post = $old_post; } return $html; }
function ts_person_func($atts, $content = null) { extract(shortcode_atts(array("id" => 0), $atts)); global $post; $new_post = null; if (!empty($id)) { $new_post = get_post($id); } if ($new_post) { $old_post = $post; $post = $new_post; $image = ''; if (has_post_thumbnail($post->ID, 'post')) { $image = ts_get_resized_post_thumbnail($post->ID, 'person-mid'); } $facebook = get_post_meta($post->ID, 'facebook_url', true); $twitter = get_post_meta($post->ID, 'twitter_url', true); $skype = get_post_meta($post->ID, 'skype_username', true); $dribbble = get_post_meta($post->ID, 'dribbble_url', true); $youtube = get_post_meta($post->ID, 'youtube_url', true); $content = stripslashes($post->post_content); $html = ' <article class="team-member"> <div class="item-con-t1" style="opacity: 1;"> <div class="container-t1"> <div class="container-t1-margin" style="height: 186px;">' . $image . '</div> </div> </div> <h2>' . get_the_title() . '</h2> <h3>' . get_post_meta($post->ID, 'team_position', true) . '</h3> <hr> <p>' . ts_get_shortened_string(strip_tags($content), 30) . '<br/><a class="read-more" href="' . get_permalink($post->ID) . '">' . __('read more', 'circles') . '</a></p> <hr> <ul class="socials"> ' . (!empty($facebook) ? '<li><span class="tran02slinear"></span><br><a class="facebook tran02slinear" href="' . $facebook . '" target="_blank" title="Facebook"></a></li>' : '') . ' ' . (!empty($twitter) ? '<li><span class="tran02slinear"></span><br><a class="twitter tran02slinear" href="' . $twitter . '" target="_blank" title="Twitter"></a></li>' : '') . ' ' . (!empty($skype) ? '<li><span class="tran02slinear"></span><br><a class="skype tran02slinear" href="skype:' . $skype . '?call" title="Skype"></a></li>' : '') . ' ' . (!empty($dribbble) ? '<li><span class="tran02slinear"></span><br><a class="dribbble tran02slinear" href="' . $dribbble . '" target="_blank" title="Dribble"></a></li>' : '') . ' ' . (!empty($youtube) ? '<li><span class="tran02slinear"></span><br><a class="youtube tran02slinear" href="' . $youtube . '" target="_blank" title="Youtube"></a></li>' : '') . ' </ul> </article>'; $post = $old_post; } return $html; }
?> </h2> <?php echo ot_get_option('portfolio_page_related_projects_description'); ?> <span id='flexslider-related-works-prev' class='prev-t1'></span> <span id='flexslider-related-works-next' class='next-t1'></span> </div> <div class='grid_9'> <div class='flexslider widget_recent_works-container clearfix' id='flexslider-related-works'> <ul class='slides'> <?php while (have_posts()) { the_post(); if (has_post_thumbnail($post->ID)) { $image = ts_get_resized_post_thumbnail($post->ID, 'related-works', get_the_title()); $image_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail'); if (!isset($image_src[0])) { $image_src = array(); $image_src[0] = '#'; } } else { continue; } $terms = wp_get_post_terms($post->ID, 'portfolio-categories', $args); $term_slugs = array(); $term_names = array(); if (count($terms) > 0) { foreach ($terms as $term) { $term_slugs[] = $term->slug; $term_names[] = $term->name;
/** * Get resized post thumbnail, checks for sidebars and choose best resolution * @global object $post * @param array $sizes array of 3 sizes, 0 - no sidebars, 1 - one siedebar, 2 - two siedbars, eg. array('600,300','400,200','300,150') * @param string $alt * @param string $class * @return string * @since framework 1.0 */ function ts_get_resized_post_thumbnail_sidebar($post_id, $sizes, $alt = '', $class = '') { if (ts_check_if_two_sidebars()) { $size = 2; } else { if (ts_check_if_sidebar()) { $size = 1; } else { $size = 0; } } if (!isset($sizes[$size])) { $current_size = false; } else { $current_size = $sizes[$size]; } return ts_get_resized_post_thumbnail($post_id, $current_size, $alt, $class); }
function ts_testimonials_func($atts, $content = null) { extract(shortcode_atts(array("type" => 'slider', "category" => '', "limit" => "2", "title" => ""), $atts)); global $query_string, $post; $args = array('posts_per_page' => $limit, 'offset' => 0, 'cat' => $category, 'orderby' => 'date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'testimonials-widget', 'post_mime_type' => '', 'post_parent' => '', 'paged' => 1, 'post_status' => 'publish'); $the_query = new WP_Query($args); $content = ''; if ($the_query->have_posts()) { global $post; while ($the_query->have_posts()) { $the_query->the_post(); $widget_title = get_post_meta($post->ID, 'testimonials-widget-title', true); $email = get_post_meta($post->ID, 'testimonials-widget-email', true); $company = get_post_meta($post->ID, 'testimonials-widget-company', true); $url = get_post_meta($post->ID, 'testimonials-widget-url', true); $author = get_the_title($post->ID); if (!empty($email)) { $author = '<a class="author" href="mailto:' . $email . '">' . $author . '</a>'; } else { $author = '<div class="author">' . $author . '</div>'; } if (!empty($company)) { if (!empty($url)) { $company = '<a href="' . $url . '" target="_blank">' . (!empty($widget_title) ? ', ' : '') . $company . '</a>'; } } $post_content = stripslashes($post->post_content); if ($type == 'slider2') { $item = ' <article class="item"> <div class="item-helper"> <div class="avatar"> ' . ts_get_resized_post_thumbnail($post->ID, 'author', get_the_title($post->ID)) . ' </div> ' . $author . ' <span class="info">' . $widget_title . $company . '</span> </div> <div class="item-body"> <div class="quote"> <span class="helper"></span> ' . $post_content . ' </div> </div> </article>'; } else { $author .= '<span>' . $widget_title . ' ' . $company . '</span>'; $item = ' <article> <div class="container-t1"> <div class="quote"> <p>' . $post_content . '</p> <div class="helper"></div> </div> </div> <header> ' . $author . ' </header> </article>'; } if ($type == 'static') { $content .= $item; } else { $content .= '<li>' . $item . '</li>'; } } } // Restor original Query & Post Data wp_reset_query(); wp_reset_postdata(); if ($type == 'static') { return ' <section class="widget_testimonials_2"> ' . $content . ' </section>'; } if ($type == 'slider2') { $rand = rand(1, 5000); return ' <div class="widget_testimonials-container sss clearfix flexslider" id="flexslider-testimonials-' . $rand . '"> <header> <h2>' . $title . '</h2> </header> <ul class="slides"> ' . $content . ' </ul> </div> <script type="text/javascript"> jQuery(document).ready(function() { jQuery("#flexslider-testimonials-' . $rand . '").flexslider({ animation: "slide", controlNav: false }); }); </script>'; } else { $rand = rand(1, 5000); return ' <div class="flexslider-testimonials ss widget_testimonials_2"> <div class="flexslider testimonials-slider" id="flexslider-testimonials-' . $rand . '"> <ul class="slides"> ' . $content . ' </ul> </div> </div> <script type="text/javascript"> jQuery(document).ready(function() { jQuery("#flexslider-testimonials-' . $rand . '").flexslider({ animation: "slide", controlNav: false, directionNav: true, itemWidth: 200, itemMargin: 0, minItems: 1, maxItems: 1, move:1 }); }); </script>'; } }
function ts_recent_projects_func($atts, $content = null) { // extract(shortcode_atts(array( // ), // $atts)); global $query_string, $post; $args = array('numberposts' => "", 'posts_per_page' => 3, 'meta_query' => array(array('key' => '_thumbnail_id')), 'offset' => 0, 'cat' => '', 'orderby' => 'date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'portfolio', 'post_mime_type' => '', 'post_parent' => '', 'paged' => 1, 'post_status' => 'publish'); $the_query = new WP_Query($args); if ($the_query->have_posts()) { $list = ''; while ($the_query->have_posts()) { $the_query->the_post(); if (has_post_thumbnail($post->ID)) { $image = ts_get_resized_post_thumbnail($post->ID, 'recent-projects', get_the_title()); $image_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail'); if (!isset($image_src[0])) { $image_src = array(); $image_src[0] = '#'; } } else { continue; } $terms = strip_tags(get_the_term_list($post->ID, 'portfolio-categories', '', ' ', '')); $gallery_html = ''; $title = get_the_title(); switch (get_post_format()) { case 'gallery': $gallery = get_post_meta($post->ID, 'gallery_images', true); if (is_array($gallery) && count($gallery) > 0) { foreach ($gallery as $key => $val) { if ($key == 0) { $title = $val['title']; $prettyPhotoContent = $val['image']; } else { $gallery_html .= '<a rel="prettyPhoto[gallery-' . $post->ID . ']" href="' . $val['image'] . '" title="' . esc_attr($val['title']) . '"></a>'; } } } $icon = 'format-gallery'; $rel = 'prettyPhoto[gallery-' . $post->ID . ']'; break; case 'video': $prettyPhotoContent = get_post_meta($post->ID, 'video_url', true); $icon = 'video'; $rel = 'prettyPhoto'; break; default: $prettyPhotoContent = $image_src[0]; $icon = 'zoom'; $rel = 'prettyPhoto'; } $list .= ' <article class="theme-one-third"> <div class="container-t1"> <div class="container-margin"> ' . $image . ' <div class="facilities visible-on-hover"> <div class="bg-black-045"></div> <div class="image-links"> <a rel="' . $rel . '" title="' . esc_attr($title) . '" href="' . $prettyPhotoContent . '"><span class="' . $icon . '"></span></a> <a rel="" title="' . esc_attr($title) . '" href="' . get_permalink() . '"><span class="link"></span></a> </div> </div> ' . $gallery_html . ' </div> </div> <header> <h2>' . get_the_title() . '</h2> <h3>' . $terms . '</h3> </header> </article>'; } if (!empty($list)) { $content = ' <section class="recent_projects"> ' . $list . ' </section>'; } // Restor original Query & Post Data wp_reset_query(); wp_reset_postdata(); } return $content; }
function ts_featured_projects_func($atts, $content = null) { global $post; extract(shortcode_atts(array('header' => '', 'category' => '', 'limit' => 10), $atts)); $html = ''; $args = array('numberposts' => "", 'posts_per_page' => $limit, 'meta_query' => array(array('key' => '_thumbnail_id')), 'offset' => 0, 'orderby' => 'date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'portfolio', 'post_mime_type' => '', 'post_parent' => '', 'paged' => 1, 'post_status' => 'publish'); if (!empty($category)) { $args['tax_query'] = array(array('taxonomy' => 'portfolio-categories', 'field' => 'id', 'terms' => explode(',', $category))); } $the_query = new WP_Query($args); if ($the_query->have_posts()) { $list = ''; while ($the_query->have_posts()) { $the_query->the_post(); if (has_post_thumbnail($post->ID)) { $image = ts_get_resized_post_thumbnail($post->ID, 'featured-projects', get_the_title()); } else { continue; } $terms = strip_tags(get_the_term_list($post->ID, 'portfolio-categories', '', ' ', '')); $a1 = '<a rel="" title="' . esc_attr(get_the_title()) . '" href="' . get_permalink() . '">'; $a2 = '</a>'; $list .= ' <li> <article class="featured-project"> ' . $a1 . $image . $a2 . ' <div class="project-body"> ' . $a1 . ' <h2>' . ts_get_shortened_string_by_letters(get_the_title(), 20, true) . '</h2> <h3>' . $terms . '</h3> ' . $a2 . ' <span class="likes icon-heart" data-post-id="' . $post->ID . '">' . ts_get_theme_likes($post->ID) . '</span> </div> </article> </li>'; } if (!empty($list)) { $rand = rand(1, 10000); $html = ' <div class="featured-projects"> <div class="sc-divider sc-divider-center sc-divider-normal"><div class="sc-divider-text">' . $header . '</div></div> ' . $content . ' <div class="pagination"> <span id="flexslider-featured-projects-prev-' . $rand . '" class="prev-t1"></span> <span id="flexslider-featured-projects-next-' . $rand . '" class="next-t1"></span> </div> <div id="flexslider-featured-projects-' . $rand . '" class="flexslider featured-project-slider"> <ul class="slides"> ' . $list . ' </ul> </div> </div> <script type="text/javascript"> jQuery(document).ready(function() { jQuery("#flexslider-featured-projects-' . $rand . '").flexslider({ animation: "slide", animationLoop: true, itemWidth: 320, itemMargin: 0, slideshow: false, controlNav: false, directionNav: false, minItems: 4, maxItems: 4, move: 1 }); jQuery("#flexslider-featured-projects-prev-' . $rand . '").click(function(){ jQuery("#flexslider-featured-projects-' . $rand . '").flexslider("prev"); }); jQuery("#flexslider-featured-projects-next-' . $rand . '").click(function(){ jQuery("#flexslider-featured-projects-' . $rand . '").flexslider("next"); }); }); </script>'; } // Restor original Query & Post Data wp_reset_query(); wp_reset_postdata(); } return $html; }
function ts_latest_posts_func($atts, $content = null) { extract(shortcode_atts(array("header" => '', "limit" => 10), $atts)); if (!(int) $limit) { $limit = 10; } $rand = rand(1, 1000); global $query_string, $post; $args = array('posts_per_page' => $limit, 'offset' => 0, 'cat' => '', 'orderby' => 'date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_mime_type' => '', 'post_parent' => '', 'paged' => 1, 'post_status' => 'publish'); $the_query = new WP_Query($args); $content = ''; $rand = rand(1, 1000); if ($the_query->have_posts()) { $embadded_video = ''; $galleries = array(); $list = ''; while ($the_query->have_posts()) { $the_query->the_post(); $media = ''; $embadded_video = ''; $show_overlay = true; if (get_post_format($post->ID) == 'video') { $url = get_post_meta($post->ID, 'video_url', true); if (!empty($url)) { $embadded_video = ts_get_embaded_video($url); } else { if (empty($url)) { $embadded_video = get_post_meta($post->ID, 'embedded_video', true); } } } if (!empty($embadded_video)) { $media = '<div class="post-img post-video">'; $media .= '<div class="videoWrapper">'; $media .= $embadded_video; $media .= '</div>'; $media .= '</div>'; $media .= '<div class="clear"></div>'; $show_overlay = false; } else { if (get_post_format($post->ID) == 'gallery') { $gallery = get_post_meta($post->ID, 'gallery_images', true); if (is_array($gallery) && count($gallery) > 0) { $rand2 = rand(1, 1000); $media = '<div class="flexslider fs-inner latest-posts-gallery" id="flexslider-latest-posts-gallery-' . $post->ID . '-' . $rand2 . '">'; $media .= '<ul class="slides-inner">'; foreach ($gallery as $image) { $media .= '<li>' . ts_get_resized_image_by_size($image['image'], 'latest-posts', $image['title']) . '</li>'; } $media .= '</ul>'; $media .= '</div>'; $galleries[] = $post->ID . '-' . $rand2; $show_overlay = false; } else { $media = ts_get_resized_post_thumbnail($post->ID, 'latest-posts', get_the_title($post->ID)); } } else { if (has_post_thumbnail()) { $media = ts_get_resized_post_thumbnail($post->ID, 'latest-posts', get_the_title($post->ID)); } } } $comments = get_comments_number(); $list .= "\n\t\t\t\t<li>\n\t\t\t\t\t<article class='item'>"; if (!empty($media)) { $list .= "\n\t\t\t\t\t\t<div class='item-con-t1'>\n\t\t\t\t\t\t\t<div class='container-t1'>\n\t\t\t\t\t\t\t\t<div class='container-t1-margin'>\n\t\t\t\t\t\t\t\t\t" . ($show_overlay === true ? "\n\t\t\t\t\t\t\t\t\t\t<footer class='visible-on-hover'>\n\t\t\t\t\t\t\t\t\t\t\t<div class='bg-black-045'></div>\n\t\t\t\t\t\t\t\t\t\t\t<div class='widget_recent_posts_2-fac'>\n\t\t\t\t\t\t\t\t\t\t\t\t<div class='date'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span>" . get_the_time(get_option('date_format')) . "</span>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t<div class='category'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . get_the_category_list(', ', '', $post->ID) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</footer>\n\t\t\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t\t\t\t" . $media . "\n\t\t\t\t\t\t\t\t\t" . ($show_overlay === true ? "\n\t\t\t\t\t\t\t\t\t\t<div class='facilities visible-on-hover'>\n\t\t\t\t\t\t\t\t\t\t\t<div class='bg-black-020'></div>\n\t\t\t\t\t\t\t\t\t\t\t<div class='image-links'>\n\t\t\t\t\t\t\t\t\t\t\t\t<a rel='' title='" . esc_attr(get_the_title()) . "' href='" . get_permalink() . "'><span class='add'></span></a>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t" : "") . "\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class='blue-line visible-on-hover tran03slinear'></div>\n\t\t\t\t\t\t</div>"; } $list .= "\n\t\t\t\t\t\t<div class='item-body'>\n\t\t\t\t\t\t\t<div class='item-helper'>\n\t\t\t\t\t\t\t\t<div class='avatar big'>\n\t\t\t\t\t\t\t\t\t" . get_avatar($post->post_author, 71) . "\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class='post-comments'>\n\t\t\t\t\t\t\t\t\t<span>" . $comments . "</span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class='post-author'>\n\t\t\t\t\t\t\t\t\tBy\n\t\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t\t" . get_the_author_link() . "\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<header>\n\t\t\t\t\t\t\t\t<a href='" . get_permalink() . "'><h2>" . get_the_title() . "</h2></a>\n\t\t\t\t\t\t\t\t<p>" . get_post_meta($post->ID)['_aioseop_description'][0] . "</p>\n\t\t\t\t\t\t\t</header>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</article>\n\t\t\t\t</li>"; } $content = "\n\t\t\t<section class='widget widget_recent_posts_2'>\n\t\t\t\t<div class='grid_12'>\n\t\t\t\t<h2 class='title'>" . $header . "</h2>\n\t\t\t\t<div class='separator'>\n\t\t\t\t\t<div></div>\n\t\t\t\t</div>\n\t\t\t\t<div class='pagination'>\n\t\t\t\t\t<span id='flexslider-latest-posts-prev-" . $rand . "' class='prev-t1'></span>\n\t\t\t\t\t<span id='flexslider-latest-posts-next-" . $rand . "' class='next-t1'></span>\n\t\t\t\t</div>\n\t\t\t\t\t<div id='flexslider-latest-posts-" . $rand . "' class='flexslider widget_recent_posts_2-container clearfix'>\n\t\t\t\t\t\t<ul class='slides'>" . $list . "</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</section>\n\t\t\t<script type='text/javascript'>\n\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\tjQuery('#flexslider-latest-posts-" . $rand . "').flexslider({\n\t\t\t\t\t\tanimation: 'slide',\n\t\t\t\t\t\tanimationLoop: true,\n\t\t\t\t\t\titemWidth: 320,\n\t\t\t\t\t\titemMargin: 0,\n\t\t\t\t\t\tslideshow: false,\n\t\t\t\t\t\tcontrolNav: false,\n\t\t\t\t\t\tdirectionNav: false,\n\t\t\t\t\t\tminItems: 3,\n\t\t\t\t\t\tmaxItems: 3,\n\t\t\t\t\t\tmove: 1\n\t\t\t\t\t});\n\n\t\t\t\t\tjQuery('#flexslider-latest-posts-prev-" . $rand . "').click(function(){\n\t\t\t\t\t\tjQuery('#flexslider-latest-posts-" . $rand . "').flexslider('prev');\n\t\t\t\t\t});\n\n\t\t\t\t\tjQuery('#flexslider-latest-posts-next-" . $rand . "').click(function(){\n\t\t\t\t\t\tjQuery('#flexslider-latest-posts-" . $rand . "').flexslider('next');\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t</script>"; if (is_array($galleries) && count($galleries) > 0) { foreach ($galleries as $gallery) { $content .= ' <script type="text/javascript"> jQuery(document).ready(function() { jQuery("#flexslider-latest-posts-gallery-' . $gallery . '").flexslider({ selector: ".slides-inner > li", animation: "slide", animationLoop: true, controlNav: false, slideshowSpeed: 3000, prevText: "' . ts_get_prev_slider_text() . '", nextText: "' . ts_get_next_slider_text() . '" }); }); </script>'; } } } // Restor original Query & Post Data wp_reset_query(); wp_reset_postdata(); return $content; }
function ts_latest_works_func($atts, $content = null) { extract(shortcode_atts(array("header" => __('Latest Works', 'framework'), "description" => '', "limit" => 10), $atts)); $rand = rand(1, 1000); global $query_string, $post; $args = array('numberposts' => "", 'posts_per_page' => $limit, 'meta_query' => array(array('key' => '_thumbnail_id')), 'offset' => 0, 'cat' => '', 'orderby' => 'date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'portfolio', 'post_mime_type' => '', 'post_parent' => '', 'paged' => 1, 'post_status' => 'publish'); $the_query = new WP_Query($args); if ($the_query->have_posts()) { $list = ''; while ($the_query->have_posts()) { $the_query->the_post(); if (has_post_thumbnail($post->ID)) { $image = ts_get_resized_post_thumbnail($post->ID, 'latest-works', get_the_title()); $image_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail'); if (!isset($image_src[0])) { $image_src = array(); $image_src[0] = '#'; } } else { continue; } $terms = strip_tags(get_the_term_list($post->ID, 'portfolio-categories', '', ' ', '')); $gallery_html = ''; $title = get_the_title(); switch (get_post_format()) { case 'gallery': $gallery = get_post_meta($post->ID, 'gallery_images', true); if (is_array($gallery) && count($gallery) > 0) { foreach ($gallery as $key => $val) { if ($key == 0) { $title = $val['title']; $prettyPhotoContent = $val['image']; } else { $gallery_html .= '<a rel="prettyPhoto[gallery-' . $post->ID . ']" href="' . $val['image'] . '" title="' . esc_attr($val['title']) . '"></a>'; } } } $icon = 'format-gallery'; $rel = 'prettyPhoto[gallery-' . $post->ID . ']'; break; case 'video': $prettyPhotoContent = get_post_meta($post->ID, 'video_url', true); $icon = 'video'; $rel = 'prettyPhoto'; break; default: $prettyPhotoContent = $image_src[0]; $icon = 'zoom'; $rel = 'prettyPhoto'; } $list .= "\n\t\t\t\t<li>\n\t\t\t\t\t<article class='item-con-t1'>\n\t\t\t\t\t\t<div class='container-t1'>\n\t\t\t\t\t\t\t<div class='container-t1-margin'>\n\t\t\t\t\t\t\t\t<header>\n\t\t\t\t\t\t\t\t\t<div class='bg-black-045'></div>\n\t\t\t\t\t\t\t\t\t<h2>" . get_the_title() . "</h2>\n\t\t\t\t\t\t\t\t\t<h3>" . $terms . "</h3>\n\t\t\t\t\t\t\t\t</header>\n\t\t\t\t\t\t\t\t" . $image . "\n\t\t\t\t\t\t\t\t<div class='facilities visible-on-hover'>\n\t\t\t\t\t\t\t\t\t<div class='bg-black-045'></div>\n\t\t\t\t\t\t\t\t\t<div class='image-links'>\n\t\t\t\t\t\t\t\t\t\t<a rel='" . $rel . "' title='" . esc_attr($title) . "' href='" . $prettyPhotoContent . "'><span class='" . $icon . "'></span></a>\n\t\t\t\t\t\t\t\t\t\t<a title='" . esc_attr(get_the_title()) . "' href='" . get_permalink() . "'><span class='link'></span></a>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t" . $gallery_html . "\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class='blue-line visible-on-hover tran03slinear'></div>\n\t\t\t\t\t</article>\n\t\t\t\t</li>"; } if (!empty($list)) { $content = "\n\t\t\t\t<section class='widget widget_recent_works'>\n\t\t\t\t\t<div class='grid_3'>\n\t\t\t\t\t\t<h2>" . $header . "</h2>\n\t\t\t\t\t\t<p>" . $description . "</p>\n\t\t\t\t\t\t<span id='flexslider-latest-works-prev-" . $rand . "' class='prev-t1'></span>\n\t\t\t\t\t\t<span id='flexslider-latest-works-next-" . $rand . "' class='next-t1'></span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='grid_9'>\n\t\t\t\t\t\t<div class='flexslider widget_recent_works-container clearfix' id='flexslider-latest-works-" . $rand . "'>\n\t\t\t\t\t\t\t<ul class='slides'>" . $list . "</ul>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</section>"; $content .= ' <script type="text/javascript"> jQuery(document).ready(function() { jQuery("#flexslider-latest-works-' . $rand . '").flexslider({ animation: "slide", animationLoop: true, itemWidth: 250, itemMargin: 0, slideshow: false, controlNav: false, directionNav: false, minItems: 1, maxItems:3, move: 1 }); jQuery("#flexslider-latest-works-prev-' . $rand . '").click(function(){ jQuery("#flexslider-latest-works-' . $rand . '").flexslider("prev"); }); jQuery("#flexslider-latest-works-next-' . $rand . '").click(function(){ jQuery("#flexslider-latest-works-' . $rand . '").flexslider("next"); }); }); </script> '; } // Restor original Query & Post Data wp_reset_query(); wp_reset_postdata(); } return $content; }