function ts_embed_media_func($atts, $content = null) { $embed = ts_get_embaded_video($content); if (empty($embed)) { global $wp_embed; $embed = $wp_embed->run_shortcode('[embed width=640 height=480]' . $content . '[/embed]'); } return '<div class="sc-embed-media">' . $embed . '</div>'; }
<?php get_template_part('templates/blog-classic/parts/part', 'header'); ?> <?php get_template_part('templates/blog-classic/parts/part', 'meta'); ?> <!-- Media --> <div class="blog-media"> <?php $url = ts_get_post_opt('post-video-url'); if (!empty($url)) { $embadded_video = ts_get_embaded_video($url); } else { if (empty($url)) { $embadded_video = ts_get_post_opt('post-video-html'); } } if ($embadded_video != '') { echo wp_kses($embadded_video, ts_add_iframe_to_allowed_tags()); } else { if (has_post_thumbnail()) { ?> <a href="<?php echo esc_url(get_permalink()); ?> ">
?> <?php $thumb = "\n\t\t\t\t<div class='facilities visible-on-hover'>\n\t\t\t\t\t<div class='gallery-image-links'>\n\t\t\t\t\t\t<a class='prev' title='" . __('Previous', 'circles') . "' href='#' id='prev-" . $post->ID . "'>\n\t\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t\t<span class='tran03slinear'></span>\n\t\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t\t<a class='next' title='" . __('Next', 'circles') . "' href='#' id='next-" . $post->ID . "'>\n\t\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t\t<span class='tran03slinear'></span>\n\t\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</div>\n\t\t\t\t\t<a class='image-link' rel='prettyPhoto' title='Sed diam nonumy' href='http://circles.arenaofthemes.com/wp-content/uploads/2013/03/smaller_size-3.jpg'><span class='zoom'></span></a>\n\t\t\t\t</div>\n\t\t\t\t\t<div class='flexslider' id='flexslider-" . $post->ID . "'>\n\t\t\t\t\t\t<ul class='slides'>"; foreach ($gallery as $image) { $thumb .= "<li>" . ts_get_resized_image_sidebar($image['image'], array('full', 'one-sidebar', 'two-sidebars'), $image['title']) . "</li>"; } $thumb .= "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t </div>\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\t jQuery('#flexslider-" . $post->ID . "').flexslider({\n\t\t\t\t\t\t\tanimation: 'slide',\n\t\t\t\t\t\t\tcontrolNav: false,\n\t\t\t\t\t\t\tprevText: \"" . ts_get_prev_slider_text() . "\",\n\t\t\t\t\t\t\tnextText: \"" . ts_get_next_slider_text() . "\"\n\t\t\t\t\t\t });\n\t\t\t\t\t\t});\n\t\t\t\t\t\tjQuery('#prev-" . $post->ID . "').click(function(){\n\t\t\t\t\t\t\tjQuery('#flexslider-" . $post->ID . "').flexslider('prev');\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tjQuery('#next-" . $post->ID . "').click(function(){\n\t\t\t\t\t\t\tjQuery('#flexslider-" . $post->ID . "').flexslider('next');\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t</script>"; } break; case 'video': $url = get_post_meta($post->ID, 'video_url', true); if (!empty($url)) { $thumb = ts_get_embaded_video($url); } else { if (empty($url)) { $thumb = get_post_meta($post->ID, 'embedded_video', true); } } $thumb = '<div class="videoWrapper">' . $thumb . '</div>'; break; default: $thumb = "<img class='singleImage' src=" . wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'thumbnail')) . " >"; break; } ?> <header> <a href='<?php the_permalink();
function ts_posts_slider_func($atts, $content = null) { extract(shortcode_atts(array("id" => "", "post_type" => "post", "category" => "", "limit" => 10, "orderby" => "date", "order" => "desc", "description" => "excerpt", "excerpt" => 0), $atts)); switch ($order) { case 'asc': case 'ASC': $order = 'ASC'; break; case 'desc': case 'DESC': default: $order = 'DESC'; break; } $post_ids = array(); if (!empty($id)) { $post_ids = explode(',', $id); } global $query_string, $post; $args = array('posts_per_page' => $limit, 'offset' => 0, 'cat' => $category, 'orderby' => $orderby, 'order' => $order, 'post__in' => $post_ids, 'post_type' => $post_type, 'paged' => 1, 'post_status' => 'publish'); $the_query = new WP_Query($args); $content = ''; if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); $content .= '<li>'; $content .= '<article class="post link left post-slider">'; $embadded_video = ''; 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)) { $content .= '<div class="videoWrapper"><img src="' . get_bloginfo("template_directory") . '/img/img16_9.png" alt=""/>'; $content .= $embadded_video; $content .= '</div>'; } else { $content .= ts_get_resized_post_thumbnail_sidebar($post->ID, array('full', 'one-sidebar', 'two-sidebars')); } $comments = get_comments_number(); switch ($comments) { case 0: $comments_msg = __('No comments', 'circles'); break; case 1: $comments_msg = __('1 Comment', 'circles'); break; default: $comments_msg = sprintf(__('%s Comments', 'circles'), $comments); break; } $content .= ' <header> <a href="' . get_permalink() . '" title="' . esc_attr(get_the_title()) . '">' . get_the_title() . '</a> </header> <footer> <div class="post-helper-absolute"> <div class="post-day-aside"> <span>' . get_the_time('d') . '</span> </div> <div class="post-month-aside"> <span>' . get_the_time('M') . ', ' . get_the_time('Y') . '</span> </div> </div> <div class="post-author inline"> By <span> ' . get_the_author_link() . ' </span> </div> <div class="post-category"> <span> ' . get_the_category_list(', ', '', $post->ID) . ' </span> </div> <div class="post-comments inline"> <span><a href="' . get_permalink() . '#comments">' . $comments_msg . '</a></span> </div> </footer>'; if ($description == 'excerpt') { $excerpt_limit = 'regular'; if ((int) $excerpt) { $excerpt_limit = $excerpt; } $content .= ' <div class="post-body-text"> <p>' . ts_get_the_excerpt_theme($excerpt_limit) . ' <a href="' . get_permalink() . '" title="' . esc_attr(get_the_title()) . '" class="read-more">' . __('read more', 'circles') . '</a></p> </div>'; } $content .= '</article>'; $content .= '</li>'; } } $rand = rand(1, 5000); $content = ' <div class="flexslider flexslider-posts-slider images-slider" id="flexslider-posts-slider-' . $rand . '"> <ul class="slides"> ' . $content . ' </ul> </div> <script type="text/javascript"> jQuery(document).ready(function() { jQuery("#flexslider-posts-slider-' . $rand . '").flexslider({ animation: "slide", controlNav: false, prevText: "' . ts_get_prev_slider_text() . '", nextText: "' . ts_get_next_slider_text() . '" }); }); </script>'; // Restore original Query & Post Data wp_reset_query(); wp_reset_postdata(); return $content; }
/** * Get circles thumbnail (image,gallery slider or video), must be run in loop * @global object $post * @param array $sizes different sizes for page without or with one or two sidebars * @return string */ function ts_get_circles_thumb($sizes) { global $post; $thumb = ''; switch (get_post_format()) { case 'gallery': $gallery = get_post_meta($post->ID, 'gallery_images', true); if (is_array($gallery) && count($gallery) > 0) { $thumb = "\n\t\t\t\t\t<div class='flexslider' id='flexslider-" . $post->ID . "'>\n\t\t\t\t\t\t<ul class='slides'>"; foreach ($gallery as $image) { $thumb .= "<li>" . ts_get_resized_image_sidebar($image['image'], $sizes, $image['title']) . "</li>"; } $thumb .= ' </ul> </div> <script type="text/javascript"> jQuery(document).ready(function() { jQuery("#flexslider-' . $post->ID . '").flexslider({ animation: "slide", controlNav: false, prevText: "' . ts_get_prev_slider_text() . '", nextText: "' . ts_get_next_slider_text() . '" }); }); </script>'; } break; case 'video': $url = get_post_meta($post->ID, 'video_url', true); if (!empty($url)) { $thumb = ts_get_embaded_video($url); } else { if (empty($url)) { $thumb = get_post_meta($post->ID, 'embedded_video', true); } } $thumb = '<div class="videoWrapper">' . $thumb . '</div>'; break; default: $thumb = ts_get_resized_post_thumbnail_sidebar($post->ID, $sizes, get_the_title()); break; } return $thumb; }
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; }