function tfuse_latest_reviews($atts, $content = null) { extract(shortcode_atts(array('title' => '', 'items' => ''), $atts)); $query = new WP_Query(array('post_type' => 'review', 'orderby' => 'post_date', 'order ' => 'DESC', 'posts_per_page' => $items)); $posts = $query->get_posts(); $return_html = $img = ''; if (!empty($posts)) { $return_html .= '<div class="widget widget_recent_entries"> <h3 class="widget-title">Latest Reviews</h3> <ul class="side-postlist">'; foreach ($posts as $post) { $post_image_src = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); if (!empty($post_image_src)) { $get_image = new TF_GET_IMAGE(); $img = $get_image->properties(array('class' => '', 'alt' => get_the_title($post->ID)))->width(62)->height(62)->src($post_image_src)->resize(true)->get_img(); } $return_html .= '<li>'; if (!empty($img)) { $return_html .= '<a href="' . get_permalink($post->ID) . '" class="post-thumbnail"> ' . $img . ' </a>'; } $return_html .= '<a href="' . get_permalink($post->ID) . '" class="post-title">' . get_the_title($post->ID) . '</a> <span class="comments-link"><a href="' . get_permalink($post->ID) . '#comments">' . tfuse_get_comments(true, $post->ID) . '</a></span> </li>'; } $return_html .= '</ul> </div>'; } return $return_html; }
function tfuse_sliders($atts) { global $TFUSE; extract(shortcode_atts(array('slider_id' => ''), $atts)); $output = ''; if ($slider_id != '-1') { $slider = $TFUSE->ext->slider->model->get_slider($slider_id); switch ($slider['type']) { case 'custom': if (is_array($slider['slides'])) { $slider_image_resize = isset($slider['general']['slider_image_resize']) && $slider['general']['slider_image_resize'] == 'true' ? true : false; foreach ($slider['slides'] as $k => $slide) { $image = new TF_GET_IMAGE(); $slider['slides'][$k]['slide_src'] = $image->width(1920)->height(930)->src($slide['slide_src'])->resize($slider_image_resize)->get_src(); } } break; } if (!is_array($slider['slides'])) { return; } $output .= tfuse_render_view(locate_template('/theme_config/extensions/slider/designs/' . $slider['design'] . '/template.php'), $slider); } return $output; }
/** * Menu Type * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * */ function tfuse_menu_type($atts, $content = null) { extract(shortcode_atts(array('title' => '', 'image' => '', 'link' => '#', 'link_text' => ''), $atts)); $out = ''; $out .= '<div class="col-sm-4 post menu_type"> <div class="inner">'; if ($title != '') { $out .= '<header class="entry-header"> <h1 class="entry-title"><a href="' . $link . '">' . $title . '</a></h1> </header>'; } if ($image != '') { $getimage = new TF_GET_IMAGE(); $img = $getimage->width(295)->height(295)->src($image)->get_img(); $out .= '<div class="post-thumbnail"> <a href="' . $link . '" class="post-find-more"> <span><div class="divider up"></div>' . __('Find Out More', 'tfuse') . '<div class="divider down"></div></span> </a>' . $img . ' </div>'; } $out .= '<div class="entry-content"><p>' . do_shortcode($content) . '</p></div>'; if ($link_text != '') { $out .= '<footer class="entry-meta"> <a href="' . $link . '" class="link-view-menu">' . $link_text . '</a> </footer>'; } $out .= '</div> </div>'; return $out; }
/** * Generate array with: recent/popular/most commented posts * @param string $sort Sort type (recent/popular/most commented) * @param integer $items Number of items to be extracted * @param boolean $image_post Extract or no post image * @param integer $image_width Set width of post image * @param integer $image_height Set height of post image * @param string $image_class Set class of post image * @param boolean $date_post Extract or no post date * @param string $date_format Set date format * @param string $post_type Set post type * @param string $category Set category from where posts would be extracted * @since Medica 2.0 */ function tfuse_shortcode_posts($args = null) { $defaults = array('sort' => 'recent', 'items' => 5, 'image_post' => true, 'image_width' => 54, 'image_height' => 54, 'image_class' => 'thumbnail', 'date_post' => true, 'date_format' => 'F jS, Y', 'post_type' => 'post', 'category' => '', 'specialites' => ''); extract(wp_parse_args($args, $defaults)); global $post; $tf_cat_ID = !empty($category) && empty($specialites) ? get_cat_ID($category) : ''; $specialites = empty($category) && !empty($specialites) ? $specialites : ''; if ($sort == 'recent') { $query = new WP_Query(array('post_type' => $post_type, 'orderby' => 'post_date', 'order ' => 'DESC', 'cat' => $tf_cat_ID, 'Specialites' => $specialites, 'posts_per_page' => $items)); $posts = $query->get_posts(); } elseif ($sort == 'popular') { $query = new WP_Query(array('post_type' => $post_type, 'orderby' => 'meta_value', 'meta_key' => TF_THEME_PREFIX . '_post_viewed', 'order ' => 'DESC', 'cat' => $tf_cat_ID, 'posts_per_page' => $items)); $posts = $query->get_posts(); } elseif ($sort == 'commented') { $query = new WP_Query(array('post_type' => $post_type, 'orderby' => 'comment_count', 'order ' => 'DESC', 'cat' => $tf_cat_ID, 'posts_per_page' => $items)); $posts = $query->get_posts(); } else { return false; } $tf_post_option = array(); $count = 0; if (!empty($posts)) { foreach ($posts as $post_elm) { setup_postdata($post_elm); $img = ''; if ($image_post == true) { $post_image_src = tfuse_page_options('thumbnail_image', tfuse_page_options('single_image', null, $post_elm->ID), $post_elm->ID); if (!empty($post_image_src)) { $get_image = new TF_GET_IMAGE(); $img = $get_image->properties(array('class' => $image_class, 'alt' => get_the_title($post_elm->ID)))->width($image_width)->height($image_height)->src($post_image_src)->resize(true)->get_img(); } } if (!empty($img)) { $tf_post_option[$count]['post_img'] = $img; } else { $tf_post_option[$count]['post_img'] = ''; } if ($date_post) { $time_format = apply_filters('tfuse_widget_time_format', $date_format); $tf_post_option[$count]['post_date_post'] = get_the_time($time_format, $post_elm->ID); } else { $tf_post_option[$count]['post_date_post'] = ''; } $tf_post_option[$count]['post_class'] = is_singular() && $post->ID == $post_elm->ID ? 'current-menu-item post_' . $sort : 'post_' . $sort; $tf_post_option[$count]['post_title'] = get_the_title($post_elm->ID); $tf_post_option[$count]['post_link'] = get_permalink($post_elm->ID); $tf_post_option[$count]['post_author_link'] = get_author_posts_url(get_the_author_meta('ID')); $tf_post_option[$count]['post_author_name'] = get_the_author(); $tf_post_option[$count]['post_comnt_numb'] = get_comments_number($post_elm->ID); $tf_post_option[$count]['post_comnt_numb_link'] = tfuse_get_comments(true, $post_elm->ID); $tf_post_option[$count]['post_loveit_number'] = get_post_meta($post_elm->ID, TF_THEME_PREFIX . '_post_viewed', true); $tf_post_option[$count]['post_excerpt'] = apply_filters('get_the_excerpt', $post_elm->post_excerpt); $count++; } wp_reset_postdata(); } return $tf_post_option; }
/** * Minigallery * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * * Optional arguments: * id: post/page id * order: ASC, DESC * orderby: * include: * exclude: * pretty: true/false use or not prettyPhoto * icon_plus: * class: css class e.g. boxed * carousel: jCarousel Configuration. http://sorgalla.com/projects/jcarousel/ */ function tfuse_minigallery($attr, $content = null) { extract(shortcode_atts(array('title' => '', 'id' => ''), $attr)); global $post; extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => isset($post->ID) ? $post->ID : $attr['id'], 'include' => '', 'exclude' => '', 'pretty' => true, 'carousel' => 'easing: "easeInOutQuint",animation: 600', 'class' => 'boxed', 'prettyphoto' => ''), $attr)); $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); if (empty($attachments)) { return ''; } $uniq = rand(1, 200); $out = '<h2>' . tfuse_qtranslate($title) . '</h2> <div class="minigallery_carousel"> <div class="carousel_content"> <ul id="minigallery' . $uniq . '">'; foreach ($attachments as $id => $attachment) { $link = wp_get_attachment_image_src($id, 'full', true); $image_link_attach = $link[0]; $imgsrc = wp_get_attachment_image_src($id, array(92, 92), false); $image_src = $imgsrc[0]; $image = new TF_GET_IMAGE(); $img = $image->width(92)->height(92)->properties(array('alt' => $attachment->post_title))->src($image_src)->get_img(); if ($prettyphoto == 'true') { $out .= '<li><a href="' . $image_link_attach . '" data-rel="prettyPhoto[mg' . $uniq . ']" class="zoom" rel="prettyPhoto[mg' . $uniq . ']">' . $img . '</a></li>'; } else { $out .= '<li>' . $img . '</li>'; } } $out .= '</ul> </div><a class="prev" id="minigallery' . $uniq . '_prev" href="#"><span class="tficon-shevron-left"></span></a><a class="next" id="minigallery' . $uniq . '_next" href="#"><span class="tficon-shevron-right"></span></a> </div>'; $out .= ' <script> jQuery(document).ready(function() { function mini_gallery_start(){ jQuery("#minigallery' . $uniq . '").carouFredSel({ next : "#minigallery' . $uniq . '_next", prev : "#minigallery' . $uniq . '_prev", auto: false, circular: false, infinite: true, width: "100%", scroll: { items : 1 } }); } mini_gallery_start(); jQuery("ul.tabs li").click(function(){ mini_gallery_start(); }); }); </script>'; return $out; }
/** * Slide Show * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * * Optional arguments: * width: * height: * * Slides documentation http://slidesjs.com/ */ function tfuse_slideshow($atts, $content) { global $slide; $slide = ''; extract(shortcode_atts(array('type_size' => ''), $atts)); $get_slideshow = do_shortcode($content); $uniq = rand(1, 400); $i = 0; $output = '<div class="slider slider_' . $type_size . '"> <div class="slider_container clearfix" id="slider' . $uniq . '">'; while (isset($slide['type'][$i])) { if ($slide['type'][$i] == 'image') { if ($type_size == 'medium') { $width = 600; $height = 291; } elseif ($type_size == 'small') { $width = 430; $height = 208; } else { $width = 220; $height = 107; } $getimage = new TF_GET_IMAGE(); $img = $getimage->width($width)->height($height)->src($slide['content'][$i])->get_img(); $output .= '<div class="slider-item">' . $img . '</div>'; } else { $output .= ' <div class="slider-item"><div class="inner">' . $slide['content'][$i] . '</div></div>'; } $i++; } $output .= '</div><div class="slider_pagination" id="slider' . $uniq . '_pag"></div></div> <script> jQuery(document).ready(function() { jQuery("#slider' . $uniq . '").carouFredSel({ pagination : "#slider' . $uniq . '_pag", infinite: false, auto: false, height: "auto", items: 1, scroll: { fx: "fade", duration: 200 } }); }); </script>'; return $output; }
function tfuse_members($atts, $content = null) { extract(shortcode_atts(array('post' => ''), $atts)); $output = ''; $post = explode(',', $post); $query = new WP_Query(array('posts_per_page' => -1, 'post_type' => 'member', 'post__in' => $post)); $posts = $query->get_posts(); if (!empty($posts)) { $output .= '<div class="our-team">'; foreach ($posts as $post) { $job = tfuse_page_options('job', '', $post->ID); $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); if (!empty($image)) { $image = TF_GET_IMAGE::get_src_link($image, 270, 270); } $output .= '<div class="col-lg-3 col-md-3 col-sm-6 col-xs-6"> <div class="image-our-team"> <img src="' . $image . '" alt="' . $post->post_title . '"> </div> <h3>' . $post->post_title . '</h3> <span class="function">' . $job . '</span> </div>'; } $output .= '</div>'; } return $output; }
/** * Minigallery * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * * Optional arguments: * id: post/page id * order: ASC, DESC * orderby: * include: * exclude: * pretty: true/false use or not prettyPhoto * icon_plus: * class: css class e.g. boxed * carousel: jCarousel Configuration. http://sorgalla.com/projects/jcarousel/ */ function tfuse_minigallery($attr, $content = null) { global $post; if (isset($attr['orderby'])) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if (!$attr['orderby']) { unset($attr['orderby']); } } extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => isset($post->ID) ? $post->ID : $attr['id'], 'include' => '', 'exclude' => '', 'pretty' => true, 'icon_plus' => '<span></span>', 'carousel' => 'easing: "easeInOutQuint",animation: 600', 'class' => 'boxed'), $attr)); if (!empty($include)) { $include = preg_replace('/[^0-9,]+/', '', $include); $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } } elseif (!empty($exclude)) { $exclude = preg_replace('/[^0-9,]+/', '', $exclude); $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } if (empty($attachments)) { return ''; } $uniq = rand(1, 200); $out = ' <script type="text/javascript"> jQuery(document).ready(function($) { $("#mycarousel' . $uniq . '").jcarousel({ ' . $carousel . ' }); }); </script> '; $out .= ' <div class="minigallery-list minigallery ' . $class . '"> <ul id="mycarousel' . $uniq . '" class="jcarousel-skin-tango">'; if ($icon_plus) { $out .= '<span></span>'; } foreach ($attachments as $id => $attachment) { if ($pretty) { $out .= '<li><a href="' . $attachment->guid . '" rel="prettyPhoto[gallery' . $uniq . ']">' . '<img src="' . TF_GET_IMAGE::get_src_link($attachment->guid, 102, 102) . '" alt=' . $attachment->post_title . '>' . $icon_plus . '</a></li>'; } else { $out .= '<li>' . '<img src="' . TF_GET_IMAGE::get_src_link($attachment->guid, 102, 102) . '" alt=' . $attachment->post_title . '>' . '</li>'; } } $out .= ' </ul> </div> <div class="clear"></div> '; return $out; }
/** * Banner Slider * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * */ function tfuse_banner_slider($atts, $content) { global $slide; $slide = ''; $i = 0; $uniq = rand(1, 400); extract(shortcode_atts(array('target' => '', 'title' => '', 'before_title' => ''), $atts)); $get_banner_slider = do_shortcode($content); $output = ''; $pagination = '<div class="post-navigation"><ol class="carousel-indicators">'; $output .= '<section class="about-us-slider"> <div class="divider"></div> <h2 class="before-title">' . $before_title . '</h2> <h1 class="title">' . $title . '</h1> <div class="container"> <div class="row"> <div class="col-sm-8 col-sm-offset-2 banner_container"> <div class="main-carousel"> <div id="myCarousel" class="carousel slide"> <div class="carousel-inner">'; while (isset($slide['image'][$i])) { $getimage = new TF_GET_IMAGE(); $img = $getimage->width(750)->height(489)->src($slide['image'][$i])->get_img(); if ($i == 0) { $output .= '<div class="item active"><a target="' . $target . '" href="' . $slide['url'][$i] . '">' . $img . '</a></div>'; $pagination .= '<li data-target="#myCarousel" data-slide-to="' . $i . '" class="active"></li>'; } else { $output .= '<div class="item"><a target="' . $target . '" href="' . $slide['url'][$i] . '">' . $img . '</a></div>'; $pagination .= '<li data-target="#myCarousel" data-slide-to="' . $i . '"></li>'; } $i++; } $pagination .= '</ol></div>'; $output .= '</div>' . $pagination . ' </div> </div> </div> </div> </div>'; $output .= "<script>\r\n jQuery(document).ready(function(\$) {\r\n var slider = \$('#myCarousel'), animateClass;\r\n slider.carousel({\r\n interval: 7500,\r\n pause: 'none'\r\n });\r\n slider.find('[data-animate-in]').addClass('animated');\r\n function animateSlide() {\r\n slider.find('.item').removeClass('current');\r\n slider.find('.active').addClass('current').find('[data-animate-in]').each(function () {\r\n var __this = \$(this);\r\n animateClass = __this.data('animate-in');\r\n __this.addClass(animateClass)\r\n });\r\n slider.find('.active').find('[data-animate-out]').each(function () {\r\n var __this = \$(this);\r\n animateClass = __this.data('animate-out');\r\n __this.removeClass(animateClass)\r\n });\r\n }\r\n function animateSlideEnd() {\r\n slider.find('.active').find('[data-animate-in]').each(function () {\r\n var __this = \$(this);\r\n animateClass = __this.data('animate-in');\r\n __this.removeClass(animateClass)\r\n });\r\n slider.find('.active').find('[data-animate-out]').each(function () {\r\n var __this = \$(this);\r\n animateClass = __this.data('animate-out');\r\n __this.addClass(animateClass)\r\n });\r\n }\r\n slider.find('.invisible').removeClass('invisible');\r\n animateSlide();\r\n slider.on('slid.bs.carousel', function () {\r\n animateSlide();\r\n });\r\n slider.on('slide.bs.carousel', function () {\r\n animateSlideEnd();\r\n });\r\n if (Modernizr.touch) {\r\n slider.find('.carousel-inner').swipe( {\r\n swipeUp: function() {\r\n \$(this).parent().carousel('prev');\r\n },\r\n swipeDown: function() {\r\n \$(this).parent().carousel('next');\r\n },\r\n swipeLeft: function() {\r\n \$(this).parent().carousel('prev');\r\n },\r\n swipeRight: function() {\r\n \$(this).parent().carousel('next');\r\n },\r\n threshold: 30\r\n })\r\n }\r\n });\r\n </script>"; $output .= '</section>'; return $output; }
/** * MG Fresh Posts * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * */ function tfuse_fresh_posts($atts, $content = null) { remove_filter('excerpt_length', 'tfuse_custom_excerpt_length'); add_filter('excerpt_length', 'tfuse_custom_excerpt_length_short', 99); extract(shortcode_atts(array('title' => '', 'posts' => ''), $atts)); $output = ''; if (!empty($posts)) { $posts = explode(',', $posts); $output .= '<div class="widget-container widget_featured_posts">'; if (!empty($title)) { $output .= '<h3 class="widget-title">' . tfuse_qtranslate($title) . '</h3>'; } $output .= '<ul>'; $posts = get_posts(array('post__in' => $posts)); if (!empty($posts)) { foreach ($posts as $post) { if (has_post_thumbnail($post->ID)) { $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), '', false, ''); $post_image_src = $src[0]; } else { $post_image_src = ''; } $image = new TF_GET_IMAGE(); $image->removeSizeParams = true; $img = $image->properties(array('class' => 'thumbnail'))->width(262)->height(85)->src($post_image_src)->get_img(); $link = get_permalink($post->ID); $output .= '<li class="post-item"> <div class="post-title"><a href="' . $link . '">' . $post->post_title . '</a></div> <div class="post-meta">' . __('written by ', 'tfuse') . '<span class="post-author"><a href="' . get_author_posts_url($post->post_author) . '" title="Posts by">' . get_the_author() . '</a></span></div> <div class="post-image"><a href="' . $link . '">' . $img . '</a></div> <div class="post-descr">' . $post->post_excerpt . '</div> <div class="post-more"><a href="' . $link . '">' . __('READ THE ARTICLE', 'tfuse') . '</a></div> </li>'; } } $output .= '</ul></div>'; } return $output; }
/** * Slide Show * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * * Optional arguments: * width: * height: * * Slides documentation http://slidesjs.com/ */ function tfuse_slideshow($atts, $content = null) { extract(shortcode_atts(array('width' => 400, 'height' => 300), $atts)); $content = trim($content); $image_arr = (array) preg_split("/(\r?\n)/", $content); $uniq = rand(300, 400); $out = ' <script type="text/javascript"> jQuery(document).ready(function($){ $("#slides' . $uniq . '").slides({ play: 4000, hoverPause: true, autoHeight: true, effect: "fade", fadeSpeed: 600, crossfade: true, preload: true, preloadImage: "' . get_template_directory_uri() . '/images/loading.gif"}); }); </script> <!--/ SlideShow --> '; $out .= ' <div id="slides' . $uniq . '" class="slideshow slideGallery"> <div class="slides_container"> '; foreach ($image_arr as $image) { if (!empty($image)) { $getimage = new TF_GET_IMAGE(); $img = $getimage->width($width)->height($height)->src($image)->get_img(); $out .= '<div class="slide">' . $img . '</div>' . PHP_EOL; } } $out .= ' </div> </div> '; return $out; }
function tfuse_shortcode_latest_post($atts, $content = null) { $out = ''; $recent_post = wp_get_recent_posts(array('numberposts' => 1)); if (!empty($recent_post)) { foreach ($recent_post as $post) { $image = wp_get_attachment_url(get_post_thumbnail_id($post['ID'], 'post-thumbnails')); $get_image = new TF_GET_IMAGE(); $img = $get_image->properties(array('class' => '', 'alt' => get_the_title($post['ID'])))->width(210)->height(82)->src($image)->resize(true)->get_img(); $current_post = get_post($post['ID']); $user_data = get_user_by('id', $current_post->post_author); $out .= '<article class="post"> <h2 class="entry-title"><a href="' . get_permalink($post['ID']) . '">' . get_the_title($post['ID']) . '</a></h2> <div class="entry-meta"> <time class="entry-date" datetime="">' . get_the_time(get_option('date_format'), $post['ID']) . '</time> <span class="author"> ' . __('by', 'tfuse') . ' <a href="' . get_author_posts_url($current_post->post_author, $user_data->data->user_nicename) . '">' . $user_data->data->user_nicename . '</a></span> </div> <span class="post-thumbnail">'; if (!empty($image)) { $out .= $img; } $out .= '</span> <div class="entry-content"><p>'; if (tfuse_options('post_content') == 'content') { $out .= $current_post->post_content; } else { $out .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } $out .= '</p></div> <footer class="entry-meta"> <a href="' . get_permalink($post['ID']) . '" class="btn btn-yellow"><span>' . __('find out more', 'tfuse') . '</span></a> </footer> </article>'; } } return $out; }
function tfuse_text_info($atts, $content = null) { extract(shortcode_atts(array('link' => '', 'img' => '', 'color' => '', 'title' => '', 'link_title' => ''), $atts)); $out = '<div class="block-item"> <div class="block-image"> <img src="' . TF_GET_IMAGE::get_src_link($img, 300, 280) . '" alt=""/> <div class="block-caption"><h2 style="color:' . $color . '">' . $title . '</h2></div> </div> <div class="block-aside"> ' . do_shortcode($content) . ' </div> <div class="block-meta"> <a href="' . $link . '">' . $link_title . '</a> </div> </div>'; return $out; }
/** * The template for displaying posts on archive pages. * To override this template in a child theme, copy this file * to your child theme's folder. * * @since Philanthropy 1.0 */ global $more, $post; $more = apply_filters('tfuse_more_tag', 0); $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); $art_type = tfuse_page_options('article_type'); if (!empty($image)) { if ($art_type == 'post-style-4' || $art_type == 'post-style-3') { $image = TF_GET_IMAGE::get_src_link($image, 270, 380); } elseif ($art_type == 'post-style-1' || $art_type == 'post-style-2') { $image = TF_GET_IMAGE::get_src_link($image, 269, 267); } } ?> <article class="post <?php echo $art_type; ?> "> <div class="entry-aside"> <header class="entry-header"> <?php if ($art_type != 'post-style-7') { ?> <?php if (!empty($image)) {
function tfuse_get_portfolio_singe_gallery($post_id) { $output = ''; $uniq = rand(100, 200); $width = 600; $height = 291; $images = tfuse_page_options('gallery', array(), $post_id); $output .= '<div class="slider slider_medium"> <div class="slider_container clearfix" id="slider' . $uniq . '">'; if (has_post_thumbnail($post_id)) { $src = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), '', false, ''); $getimage = new TF_GET_IMAGE(); $img = $getimage->width($width)->height($height)->src($src[0])->get_img(); $output .= '<div class="slider-item">' . $img . '</div>'; } if (!empty($images)) { foreach ($images as $item) { $getimage = new TF_GET_IMAGE(); $img = $getimage->width($width)->height($height)->src($item['url'])->get_img(); $output .= '<div class="slider-item">' . $img . '</div>'; } } $output .= '</div><div class="slider_pagination" id="slider' . $uniq . '_pag"></div></div> <script> jQuery(document).ready(function() { jQuery("#slider' . $uniq . '").carouFredSel({ pagination : "#slider' . $uniq . '_pag", infinite: false, auto: false, height: "auto", items: 1, scroll: { fx: "fade", duration: 200 } }); }); </script>'; return $output; }
function tfuse_sliders($atts) { global $TFUSE; extract(shortcode_atts(array('slider_id' => ''), $atts)); $output = ''; if ($slider_id != '-1') { $slider = $TFUSE->ext->slider->model->get_slider($slider_id); $posts = ''; switch ($slider['type']) { case 'custom': if (is_array($slider['slides'])) { $slider_image_resize = isset($slider['general']['slider_image_resize']) && $slider['general']['slider_image_resize'] == 'true' ? true : false; foreach ($slider['slides'] as $k => $slide) { $image = new TF_GET_IMAGE(); if ($slider['design'] == 'carousel_medium') { $slider['slides'][$k]['slide_src'] = $image->width(360)->height(240)->src($slide['slide_src'])->resize($slider_image_resize)->get_src(); } elseif ($slider['design'] == 'content') { $slider['slides'][$k]['slide_src'] = $image->width(430)->height(287)->src($slide['slide_src'])->resize($slider_image_resize)->get_src(); } elseif ($slider['design'] == 'home') { $slider['slides'][$k]['slide_src'] = $image->width(1349)->height(430)->src($slide['slide_src'])->resize($slider_image_resize)->get_src(); } } } break; case 'posts': $slides_posts = array(); if (isset($slider['general']['sliders_posts_from']) && $slider['general']['sliders_posts_from'] == 'game') { $from = $slider['general']['posts_select']; } elseif (isset($slider['general']['sliders_posts_from']) && $slider['general']['sliders_posts_from'] == 'review') { $from = $slider['general']['posts_select_review']; } elseif (isset($slider['general']['sliders_posts_from']) && $slider['general']['sliders_posts_from'] == 'video') { $from = $slider['general']['posts_select_video']; } elseif (isset($slider['general']['sliders_posts_from']) && $slider['general']['sliders_posts_from'] == 'post') { $from = $slider['general']['posts_select_post']; } else { $from = $slider['general']['posts_select_home']; } $args = array('post__in' => explode(',', $from)); $slides_posts = explode(',', $from); foreach ($slides_posts as $slide_posts) { $posts[] = get_post($slide_posts); } $posts = array_reverse($posts); // $args = apply_filters('tfuse_slider_posts_args', $args, $slider); // $args = apply_filters('tfuse_slider_posts_args_'.$ID, $args, $slider); break; case 'categories': // $args = 'cat='.$slider['general']['categories_select']. // '&posts_per_page='.$slider['general']['sliders_posts_number']; // $args = apply_filters('tfuse_slider_categories_args', $args, $slider); // $args = apply_filters('tfuse_slider_categories_args_'.$ID, $args, $slider); if (isset($slider['general']['sliders_posts_from']) && $slider['general']['sliders_posts_from'] == 'game') { $slides_posts = explode(',', $slider['general']['categories_select_game']); $args = array('posts_per_page' => $slider['general']['sliders_posts_number'], 'tax_query' => array(array('taxonomy' => 'games', 'field' => 'id', 'terms' => $slides_posts))); } elseif (isset($slider['general']['sliders_posts_from']) && $slider['general']['sliders_posts_from'] == 'review') { $slides_posts = explode(',', $slider['general']['categories_select_review']); $args = array('posts_per_page' => $slider['general']['sliders_posts_number'], 'tax_query' => array(array('taxonomy' => 'reviews', 'field' => 'id', 'terms' => $slides_posts))); } elseif (isset($slider['general']['sliders_posts_from']) && $slider['general']['sliders_posts_from'] == 'video') { $slides_posts = explode(',', $slider['general']['categories_select_video']); $args = array('posts_per_page' => $slider['general']['sliders_posts_number'], 'tax_query' => array(array('taxonomy' => 'videos', 'field' => 'id', 'terms' => $slides_posts))); } elseif (isset($slider['general']['sliders_posts_from']) && $slider['general']['sliders_posts_from'] == 'post') { $slides_posts = explode(',', $slider['general']['categories_select_category']); $args = array('posts_per_page' => $slider['general']['sliders_posts_number'], 'tax_query' => array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => $slides_posts))); } else { $slides_posts = explode(',', $slider['general']['categories_select_game_home']); $args = array('posts_per_page' => $slider['general']['sliders_posts_number'], 'tax_query' => array(array('taxonomy' => 'games', 'field' => 'id', 'terms' => $slides_posts))); } $query = new WP_Query($args); $posts = $query->get_posts(); break; } if (is_array($posts)) { $slider['slides'] = tfuse_get_slides_from_posts($posts, $slider); } if (!is_array($slider['slides'])) { return; } $output .= tfuse_render_view(locate_template('/theme_config/extensions/slider/designs/' . $slider['design'] . '/template.php'), $slider); } $output .= ''; return $output; }
/** * Display post media. * * To override tfuse_media() in a child theme, add your own tfuse_media() * to your child theme's file. */ function tfuse_media($return = false) { global $post; $tfuse_media['img_position'] = $tfuse_media['image'] = $tfuse_image = $tf_media_add_space = $output = ''; $tfuse_media['img_dimensions'] = array(); $tfuse_media['disable_listing_lightbox'] = tfuse_options('disable_listing_lightbox'); $tfuse_media['disable_single_lightbox'] = tfuse_options('disable_single_lightbox'); if (is_singular()) { $tfuse_media['video_link'] = tfuse_page_options('video_link'); $tfuse_media['disable_video'] = tfuse_page_options('disable_video', tfuse_options('disable_video')); $tfuse_media['disable_image'] = tfuse_page_options('disable_image', tfuse_options('disable_image')); if (!$tfuse_media['disable_image']) { $tfuse_media['image'] = tfuse_page_options('single_image', tfuse_page_options('thumbnail_image')); $tfuse_media['img_dimensions'] = tfuse_page_options('single_img_dimensions', tfuse_options('single_img_dimensions')); $tfuse_media['img_position'] = tfuse_page_options('single_img_position', tfuse_options('single_img_position')); } if (!empty($tfuse_media['video_link']) && !$tfuse_media['disable_video']) { $tfuse_media['video_dimensions'] = tfuse_page_options('video_dimensions', tfuse_options('video_dimensions')); $tfuse_media['video_position'] = tfuse_page_options('video_position', tfuse_options('video_position')); // daca avem sus video si jos imagine, adaugam un spatiu intre video si poza prin clasa tf_media_add_space if (!empty($tfuse_media['image'])) { $tf_media_add_space = ' tf_media_add_space'; } $output .= '<div class="video_embed ' . $tfuse_media['video_position'] . '" style="width:' . $tfuse_media['video_dimensions'][0] . 'px">'; $video = new TF_GET_EMBED(); $output .= $video->width($tfuse_media['video_dimensions'][0])->height($tfuse_media['video_dimensions'][1])->source('video_link')->get(); //$output .= tfuse_get_embed($tfuse_media['media_width'], $tfuse_media['media_height'], PREFIX . "_post_video"); $output .= '</div><!--/.video_embed -->'; } } elseif (!is_singular()) { $tfuse_media['image'] = tfuse_page_options('thumbnail_image'); $tfuse_media['img_dimensions'] = tfuse_page_options('thumbnail_dimensions', tfuse_options('thumbnail_dimensions')); $tfuse_media['img_position'] = tfuse_page_options('thumbnail_position', tfuse_options('thumbnail_position')); } if (!empty($tfuse_media['image'])) { $image = new TF_GET_IMAGE(); $tfuse_image = $image->width($tfuse_media['img_dimensions'][0])->height($tfuse_media['img_dimensions'][1])->properties(array('class' => 'frame_box ' . $tfuse_media['img_position'] . $tf_media_add_space))->src($tfuse_media['image'])->get_img(); } if ((!is_singular() && !$tfuse_media['disable_listing_lightbox'] || is_singular() && !$tfuse_media['disable_single_lightbox']) && !empty($tfuse_image)) { $attachments = get_children(array('post_parent' => $post->ID, 'numberposts' => -1, 'post_type' => 'attachment', 'post_mime_type' => 'image')); $output .= '<span style="display:none">'; if (!empty($attachments)) { foreach ($attachments as $att_id => $attachment) { $tfuse_src = wp_get_attachment_image_src($att_id, 'full', true); $tfuse_image_link_attach = $tfuse_src[0]; $output .= '<a href="' . $tfuse_image_link_attach . '" rel="prettyPhoto[gallery' . $post->ID . ']">' . $tfuse_media['image'] . '</a>'; } } if (!empty($tfuse_media['post_video'])) { $output .= '<a href="' . $tfuse_media['post_video'] . '" rel="prettyPhoto[gallery' . $post->ID . ']">' . $tfuse_image . '</a>'; } $output .= '</span>'; $output .= '<a href="' . $tfuse_media['image'] . '" rel="prettyPhoto[gallery' . $post->ID . ']">' . $tfuse_image . '</a>'; } else { $output .= '<a href="' . get_permalink($post->ID) . '">' . $tfuse_image . '</a>'; } if ($return) { return $output; } else { echo $output; } }
/** * Special Events * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * */ function tfuse_special_events($atts, $content = null) { extract(shortcode_atts(array('title' => '', 'before_title' => '', 'number' => 3, 'link' => '#', 'link_text' => ''), $atts)); $out = ''; $args = array('post_type' => 'event', 'meta_key' => 'special_event', 'order' => 'Desc', 'posts_per_page' => $number, 'meta_query' => array(array('key' => 'special_event', 'value' => 'true', 'compare' => '='))); $posts = get_posts($args); $out .= '<section class="special-offer"> <div class="row"> <div class="special-offer-title">'; if ($before_title != '') { $out .= '<h3 class="section-title-before">' . $before_title . '</h3>'; } if ($title != '') { $out .= '<h1 class="section-title">' . $title . '</h1>'; } $out .= '</div> <div class="divider"></div> <div class="container"> <div class="row"> <div class="col-md-8 postlist">'; foreach ($posts as $post) { $permalink = get_permalink($post->ID); $out .= '<div class="post clearfix"> <div class="inner">'; if (has_post_thumbnail($post->ID)) { $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), '', false, ''); $image = new TF_GET_IMAGE(); $img = $image->width(200)->height(200)->src($src[0])->get_src(); $out .= '<div class="post-thumbnail"><a href="' . $permalink . '" class="post-find-more"><span><div class="divider up"></div>' . __('Find Out More', 'tfuse') . '<div class="divider down"></div></span></a><img src="' . $img . '"></div>'; } $out .= '<div class="entry-aside"> <header class="entry-header"> <h1 class="entry-title"><a href="' . $permalink . '">' . get_the_title($post->ID) . '</a></h1> </header> <div class="entry-meta"> <a href="' . $permalink . '"><span class="tficon-row"></span></a> </div> <div class="clearfix"></div> <div class="entry-content">' . tfuse_get_post_excerpt($post->ID) . '</div> </div> </div> </div>'; } $out .= '</div>'; $out .= do_shortcode($content); $out .= '</div> </div>'; $out .= '<div class="divider"></div>'; if ($link != '') { $out .= '<div class="container"> <div class="row"> <div class="col-sm-8 clearfix"> <a href="' . $link . '" class="btn btn-black-transparent"><span>' . $link_text . '</span></a> </div> </div> </div>'; } $out .= '</div> </section>'; return $out; }
} else { '<p>' . the_excerpt() . '</p>'; } ?> </div> </div> <div class="post-thumbnail"> <?php if (!empty($image)) { ?> <a href="<?php the_permalink(); ?> " class="post-thumbnail-image"><span><?php _e('More', 'tfuse'); ?> </span></a> <img src="<?php echo TF_GET_IMAGE::get_src_link($image, 285, 326); ?> " alt="<?php echo get_the_title(); ?> "> <?php } ?> </div> </div> </div> </div>
/** * aici se schimba pentru fiecare tema spefica de unde ia imaginea, titlul, linkl siderului etc. * * Note that this function is hooked into the after_setup_theme hook, which runs * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. * * To override tfuse_slider_type() in a child theme, add your own tfuse_slider_type to your child theme's * functions.php file. */ function tfuse_get_slides_from_posts($posts = array(), $slider = array()) { global $post; $slides = array(); $slider_image_resize = isset($slider['general']['slider_image_resize']) && $slider['general']['slider_image_resize'] == 'true' ? $slider['general']['slider_image_resize'] : false; foreach ($posts as $k => $post) { setup_postdata($post); $tfuse_image = $image = null; if (!($single_image = tfuse_page_options('single_image'))) { continue; } $image = new TF_GET_IMAGE(); $tfuse_image = $image->width(960)->height(444)->src($single_image)->resize($slider_image_resize)->get_src(); $slides[$k]['slide_src'] = $tfuse_image; $slides[$k]['slide_url'] = get_permalink(); $slides[$k]['slide_title'] = get_the_title(); if ($subtitle = tfuse_page_options('slide_subtitle')) { $slides[$k]['slide_subtitle'] = $subtitle; } else { $slides[$k]['slide_subtitle'] = tfuse_substr(get_the_excerpt(), 50); } if ($slider['design'] == 'play') { $slides[$k]['slide_tab_title'] = tfuse_page_options('slide_tab_subtitle'); } } return $slides; }
function tfuse_projects($atts, $content = null) { extract(shortcode_atts(array('post' => ''), $atts)); $output = ''; $uniq = rand(1, 100); $post = explode(',', $post); $query = new WP_Query(array('posts_per_page' => -1, 'post_type' => 'project', 'orderby' => 'post__in', 'post__in' => $post)); $posts = $query->get_posts(); if (!empty($posts)) { $output .= '<div class="recent-slider"> <ul id="recent-slider' . $uniq . '">'; foreach ($posts as $post) { $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); if (!empty($image)) { $image = TF_GET_IMAGE::get_src_link($image, 285, 326); } $current_post = get_post($post->ID); $output .= '<li data-recentslider1="1"> <div class="recent-slider-text"> <h3 class="title"><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h3> <div class="line-title-sldier"></div> <div class="recent-slider-description">'; if (tfuse_options('post_content') == 'content') { $output .= $current_post->post_content; } else { $output .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } $output .= '</div> </div> <div class="recent-slider-image"> <a href="' . get_permalink($post->ID) . '" class="recent-slider-thumbnail"><span>' . __('More', 'tfuse') . '</span></a> <img src="' . $image . '" > </div> </li>'; } $output .= '</ul> <div id="recent-slider' . $uniq . '-controls" class="recent-slider-controls"></div> <a id="recent-slider' . $uniq . '-prev" class="prev" href="#">prev</a> <a id="recent-slider' . $uniq . '-next" class="next" href="#">next</a> </div>'; $output .= ' <script> jQuery(document).ready(function(){ function recentsliderInit() { jQuery("#recent-slider' . $uniq . '").carouFredSel({ swipe : { onTouch: true }, next : "#recent-slider' . $uniq . '-next", prev : "#recent-slider' . $uniq . '-prev", pagination : "#recent-slider' . $uniq . '-controls", infinite: false, items: 1, auto: { play: false, timeoutDuration: 0 }, scroll: { items : 1, fx: "crossfade", easing: "linear", pauseOnHover: true, duration: 300 } }); } recentsliderInit(); jQuery(window).resize(function() { recentsliderInit(); }); var tControlsHeight = jQuery(".recent-slider-controls").innerHeight(); jQuery(".recent-slider-controls").css("margin-top" , -tControlsHeight/2); //Script align center the text for two mini slider var caroufredsel_wrapper = jQuery(".caroufredsel_wrapper"); var recent_slider_text = jQuery(".recent-slider-text"); caroufredsel_wrapper.each(function(){ hei1 = jQuery(this).height(); recent_slider_text.each(function(){ hei2 = jQuery(this).height(); jQuery(this).css({ "padding-top" :hei1/2-hei2/2 }); }); }); }); </script> '; } return $output; }
echo $image; ?> " class="see-more-gallery" data-rel="prettyPhoto[<?php echo $post->ID; ?> ]" title="<?php echo get_the_title(); ?> "> <span><?php _e('More', 'tfuse'); ?> </span> </a> <img src="<?php echo TF_GET_IMAGE::get_src_link($image, 270, 270); ?> " alt=""> </div> <?php if (!empty($gallery)) { ?> <div class="gallery-array"> <?php foreach ($gallery as $img) { ?> <a href="<?php echo $img['url']; ?> " data-rel="prettyPhoto[<?php echo $post->ID;
/** * * Note that this function is hooked into the after_setup_theme hook, which runs * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. * * To override tfuse_slider_type() in a child theme, add your own tfuse_slider_type to your child theme's * functions.php file. */ function tfuse_get_slides_from_posts($posts = array(), $slider = array()) { global $post; $slides = array(); $slider_image_resize = isset($slider['general']['slider_image_resize']) && $slider['general']['slider_image_resize'] == 'true' ? $slider['general']['slider_image_resize'] : false; $k = 0; foreach ($posts as $k => $post) { $k++; setup_postdata($post); $tfuse_image = $image = null; $image = new TF_GET_IMAGE(); if ($slider['design'] == 'carousel') { if ($slider_image_resize) { $tfuse_image = get_the_post_thumbnail($post->ID, 'medium-thumb'); } else { $tfuse_image = ' <img src="' . wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')) . '" width="200" style="height:200px" alt=""/>'; } $title = get_the_title($post->ID); $slides[$k]['slide_title'] = $title; $slides[$k]['slide_src'] = $tfuse_image; $slides[$k]['slide_url'] = get_permalink(); $slides[$k]['slide_rating'] = tfuse_page_options('rating', '', $post->ID); $slides[$k]['slide_enable_rating'] = isset($slider['general']['sliders_posts_rating']) && $slider['general']['sliders_posts_rating'] == 'true' ? $slider['general']['sliders_posts_rating'] : false; } elseif ($slider['design'] == 'carousel_medium') { if ($slider_image_resize) { $tfuse_image = get_the_post_thumbnail($post->ID, 'carousel-medium-thumb'); } else { $tfuse_image = ' <img src="' . wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')) . '" width="360" style="height:240" alt=""/>'; } $title = get_the_title($post->ID); if (mb_strlen($title, 'UTF-8') > 20) { $title = substr($title, 0, 30); } $slides[$k]['slide_title'] = $title; $slides[$k]['slide_src'] = $tfuse_image; $slides[$k]['slide_url'] = get_permalink(); } elseif ($slider['design'] == 'video') { $cats = ''; if ($slider['general']['sliders_posts_from'] == 'video') { $terms = wp_get_post_terms($post->ID, 'videos'); } else { $terms = wp_get_post_terms($post->ID, 'platforms'); } if (!empty($terms)) { foreach ($terms as $term) { $cats .= $term->name . ', '; } } $tfuse_image = ' <img src="' . wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')) . '" width="75" style="height:75" alt="" class="video-thumb"/>'; $title = get_the_title($post->ID); $slides[$k]['slide_title'] = $title; $slides[$k]['slide_src'] = $tfuse_image; $slides[$k]['slide_rating'] = tfuse_page_options('rating', '', $post->ID); $slides[$k]['slide_video'] = tfuse_page_options('video_links', '', $post->ID); $slides[$k]['slide_cats'] = substr($cats, 0, -2); } elseif ($slider['design'] == 'content') { if ($slider_image_resize) { $tfuse_image = get_the_post_thumbnail($post->ID, 'content-slider-thumb'); } else { $tfuse_image = ' <img src="' . wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')) . '" width="430" style="height:297" alt=""/>'; } $title = get_the_title($post->ID); $slides[$k]['slide_title'] = $title; $slides[$k]['slide_src'] = $tfuse_image; $slides[$k]['slide_align_img'] = isset($slider['general']['posts_select_align']) && $slider['general']['posts_select_align'] == 'alignleft' ? '' : 'image-right'; $slides[$k]['slide_url'] = get_permalink(); $slides[$k]['slide_content'] = tfuse_substr(get_the_excerpt(), 300); } elseif ($slider['design'] == 'home') { $img = tfuse_page_options('game_header', '', $post->ID); if (empty($img)) { continue; } if ($slider_image_resize) { $image = new TF_GET_IMAGE(); $tfuse_image = $image->width(1349)->height(430)->src($img)->resize($slider_image_resize)->get_src(); } else { $tfuse_image = $img; } $title = get_the_title($post->ID); $slides[$k]['slide_title'] = $title; $slides[$k]['slide_src'] = $tfuse_image; $slides[$k]['slide_url'] = get_permalink(); $slides[$k]['slide_button'] = __('READ MORE', 'tfuse'); $slides[$k]['slide_content'] = tfuse_page_options('description', '', $post->ID); $slides[$k]['ios_url'] = tfuse_page_options('ios_link', '', $post->ID); $slides[$k]['android_url'] = tfuse_page_options('android_link', '', $post->ID); $slides[$k]['facebook_url'] = tfuse_page_options('facebook_link', '', $post->ID); } } wp_reset_postdata(); return $slides; }
function tfuse_ajax_get_posts() { $post_type = $_POST['post_type']; $search_param = $_POST['search_param']; $max = intval($_POST['max']); $pageNum = intval($_POST['pageNum']); $search_key = $_POST['search_key']; $allhome = $_POST['allhome']; $allblog = $_POST['allblog']; $homepage = $_POST['homepage']; $cat_ids = $_POST['cat_ids']; $cat_ID = intval($_POST['id']); $is_tax = $_POST['is_tax']; $items = get_option('posts_per_page'); $pos4 = $pos1 = $pos2 = $pos3 = $pos5 = $pos6 = $pos7 = $pos8 = $pos9 = $allpos = $pos = $pos10 = $pos11 = $pos12 = $pos13 = $pos14 = $pos15 = $pos16 = $pos17 = ''; $posts = array(); if ($pageNum <= $max) { if ($homepage == 'homepage' && $allhome == 'nonehomeall') { $specific = tfuse_options('categories_select_categ'); if (is_user_logged_in()) { $args = array('post_status' => array('publish', 'private'), 'paged' => $pageNum, 'cat' => $specific); } else { $args = array('post_status' => array('publish'), 'paged' => $pageNum, 'cat' => $specific); } $query = new WP_Query($args); $posts = $query->posts; } elseif ($homepage == 'blogpage' && $allblog == 'allblogcategories') { if (is_user_logged_in()) { $args = array('post_status' => array('publish', 'private'), 'paged' => $pageNum, 'post_type' => 'post'); } else { $args = array('post_status' => array('publish'), 'paged' => $pageNum, 'post_type' => 'post'); } $query = new WP_Query($args); $posts = $query->posts; } elseif ($homepage == 'blogpage' && $allblog == 'noneblogall') { $specific = tfuse_options('categories_select_categ_blog'); $args = array('paged' => $pageNum, 'cat' => $specific); $query = new WP_Query($args); $posts = $query->posts; } elseif ($homepage == 'homepage' && $allhome == 'allhomecategories') { if (is_user_logged_in()) { $args = array('post_status' => array('publish', 'private'), 'paged' => $pageNum, 'post_type' => 'post'); } else { $args = array('post_status' => array('publish'), 'paged' => $pageNum, 'cat' => $cat_ids); } $query = new WP_Query($args); $posts = $query->posts; } elseif ($is_tax == 'category') { if (is_user_logged_in()) { $query = new WP_Query(array('post_status' => array('publish', 'private'), 'cat' => $cat_ID, 'paged' => $pageNum)); } else { $query = new WP_Query(array('post_status' => array('publish'), 'cat' => $cat_ID, 'paged' => $pageNum)); } $posts = $query->posts; } elseif ($is_tax == 'galleries') { if (is_user_logged_in()) { $args = array('post_status' => array('publish', 'private'), 'paged' => $pageNum, 'tax_query' => array(array('taxonomy' => 'galleries', 'field' => 'id', 'terms' => $cat_ID))); } else { $args = array('post_status' => array('publish'), 'paged' => $pageNum, 'tax_query' => array(array('taxonomy' => 'galleries', 'field' => 'id', 'terms' => $cat_ID))); } $query = new WP_Query($args); $posts = $query->posts; } elseif ($is_tax == 'projects') { if (is_user_logged_in()) { $args = array('post_status' => array('publish', 'private'), 'paged' => $pageNum, 'tax_query' => array(array('taxonomy' => 'projects', 'field' => 'id', 'terms' => $cat_ID))); } else { $args = array('post_status' => array('publish'), 'paged' => $pageNum, 'tax_query' => array(array('taxonomy' => 'projects', 'field' => 'id', 'terms' => $cat_ID))); } $query = new WP_Query($args); $posts = $query->posts; } elseif ($is_tax == 'search') { $query = new WP_Query(array('post_status' => array('publish'), 's' => $search_key, 'paged' => $pageNum)); $posts = $query->posts; } $cnt = 0; foreach ($posts as $post) { $cnt++; //get date format $d = get_option('date_format'); //get comments number $num_comments = get_comments_number($post->ID); if ($num_comments == 0) { $comments = __('No Comments', 'tfuse'); } elseif ($num_comments > 1) { $comments = $num_comments . __(' Comments', 'tfuse'); } else { $comments = __('1 Comment', 'tfuse'); } if ($is_tax == 'galleries') { $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); $gallery = tfuse_page_options('gallery', '', $post->ID); $pos1 .= '<li class="gallery-item">'; if (!empty($image)) { $pos2 .= '<div class="gallery-img"> <a href="' . $image . '" class="see-more-gallery" data-rel="prettyPhoto[' . $post->ID . ']" title="' . $post->post_title . '"> <span>' . __('More', 'tfuse') . '</span> </a> <img src="' . TF_GET_IMAGE::get_src_link($image, 270, 270) . '" alt=""> </div>'; if (!empty($gallery)) { $pos3 .= '<div class="gallery-array">'; foreach ($gallery as $img) { $pos4 .= '<a href="' . $img['url'] . '" data-rel="prettyPhoto[' . $post->ID . ']" title="' . $img['title'] . '"> </a>'; } $pos5 .= '</div>'; } } $pos5 .= '<span class="title"><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></span> </li>'; $pos = $pos1 . $pos2 . $pos3 . $pos4 . $pos5; $pos1 = $pos2 = $pos3 = $pos4 = $pos5 = ''; } elseif ($is_tax == 'projects') { $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); $pos5 .= '<div class="col-md-6 col-sm-6 col-xs-12 clearfix"> <div class="post"> <div class="inner"> <div class="entry-aside"> <header class="entry-header"> <h1 class="entry-title"><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a> </h1> </header> <div class="divider"></div> <div class="entry-content">'; $pos6 .= !empty($post->post_excerpt) ? '<p>' . $post->post_excerpt . '</p>' : '<p>' . strip_tags(tfuse_shorten_string(apply_filters('the_content', $post->post_content), 50)) . '</p>'; $pos7 .= '</div> </div> <div class="post-thumbnail">'; if (!empty($image)) { $pos8 .= '<a href="' . get_permalink($post->ID) . '" class="post-thumbnail-image"><span>' . __('More', 'tfuse') . '</span></a> <img src="' . $image . '" alt="' . $post->post_title . '">'; } $pos9 .= '</div> </div> </div> </div>'; $pos = $pos5 . $pos6 . $pos7 . $pos8 . $pos9; $pos5 = $pos6 = $pos7 = $pos8 = $pos9 = ''; } elseif ($is_tax == 'category') { $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID, 'post-thumbnails')); $art_type = tfuse_page_options('article_type', '', $post->ID); if (!empty($image)) { if ($art_type == 'post-style-4' || $art_type == 'post-style-3') { $image = TF_GET_IMAGE::get_src_link($image, 270, 380); } elseif ($art_type == 'post-style-1' || $art_type == 'post-style-2') { $image = TF_GET_IMAGE::get_src_link($image, 269, 267); } } $user_data = get_user_by('id', $post->post_author); $pos11 .= '<article class="post ' . $art_type . '"> <div class="entry-aside"> <header class="entry-header">'; if ($art_type != 'post-style-7') { if (!empty($image)) { $pos12 .= '<div class="post-thumbnail"> <a href="' . get_permalink($post->ID) . '" class="post-thumbnail-image"> <span>' . __('More', 'tfuse') . '</span> </a> <img src="' . $image . '" alt=""> </div>'; } } $pos13 .= '<div class="entry-meta"> <time class="entry-date" datetime="">' . get_the_time($d, $post->ID) . '</time> <span class="author"> ' . __('by ', 'tfuse') . '<a href="' . get_author_posts_url($post->post_author, $user_data->data->user_nicename) . '">' . $user_data->data->user_nicename . '</a></span> <span class="cat-links"> ' . __('in', 'tfuse') . ' ' . tfuse_cat_links($post->post_type, $post->ID) . '</span> <h2 class="entry-title"><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h2>'; if ($art_type == 'post-style-7') { if (!empty($image)) { $pos14 .= '<div class="post-thumbnail"> <a href="' . get_permalink($post->ID) . '" class="post-thumbnail-image"> <span>' . __('More', 'tfuse') . '</span> </a> <img src="' . $image . '" alt=""> </div>'; } } $pos15 .= '</div> </header> <div class="entry-content">'; $pos16 .= !empty($post->post_excerpt) ? '<p>' . $post->post_excerpt . '</p>' : '<p>' . strip_tags(tfuse_shorten_string(apply_filters('the_content', $post->post_content), 50)) . '</p>'; $pos17 .= '</div> <footer class="entry-meta clearfix"> <a href="' . get_permalink($post->ID) . '" class="btn btn-yellow btn-read-more"><span>' . __('Read More', 'tfuse') . '</span></a> <a href="' . get_permalink($post->ID) . '#comments" class="btn btn-transparent link-comment"><span>' . $comments . '</span></a> </footer> </div> </article>'; $pos = $pos11 . $pos12 . $pos13 . $pos14 . $pos15 . $pos16 . $pos17; $pos11 = $pos12 = $pos13 = $pos14 = $pos15 = $pos16 = $pos17 = ''; } elseif ($is_tax == 'search') { $img = tfuse_page_options('thumbnail_image', null, $post->ID); if (tfuse_options('disable_listing_lightbox')) { $image = '<a href="' . $img . '" rel="prettyPhoto[gallery' . $post->ID . ']"> <img src="' . $img . '" height="200" width="220" alt=""> </a>'; } else { $image = '<a href="' . get_permalink($post->ID) . '"><img src="' . $img . '" height="200" width="220" alt="" ></a>'; } $pos1 .= '<div class="post-item clearfix"> <div class="post-image">' . $image . '</div> <div class="post-meta">'; if (tfuse_options('date_time')) { $pos2 .= '<span class="post-date">' . get_the_time($d, $post->ID) . '</span> | '; } $pos3 .= '<a href="' . get_comments_link($post->ID) . '" class="link-comments">' . $comments . '</a> </div> <div class="post-title"> <h3><a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a></h3> </div> <div class="post-descr entry"> <p>' . strip_tags(tfuse_shorten_string(apply_filters('the_content', $post->post_content), 30)) . '</p> </div> <div class="post-more"><a href="' . get_permalink($post->ID) . '">' . __('READ THE ARTICLE', 'tfuse') . '</a></div> </div>'; $pos = $pos1 . $pos2 . $pos3; $pos1 = $pos2 = $pos3 = ''; } $allpos[] = $pos; } $rsp = array('html' => $allpos, 'items' => $items, 'posts' => $posts); echo json_encode($rsp); } die; }
} ?> <?php if (!empty($gallery)) { ?> <?php foreach ($gallery as $img) { ?> <a href="<?php echo TF_GET_IMAGE::get_src_link($img['url'], 715, 498); ?> " title="<?php echo get_the_title(); ?> "><img src="<?php echo TF_GET_IMAGE::get_src_link($img['url'], 715, 498); ?> " alt="<?php echo get_the_title(); ?> "></a> <?php } ?> <?php } ?> </div> </div> <div class="entry-content">
/** * Daca a fost selectat sa fie imagine in header, optinem imaginea * in functia tfuse_get_header_content() ce se afla in * theme_config/theme_includes/THEME_HEADER_CONTENT.php * imaginea se transmite prin variabila globala $header_image */ global $header_image; if (!empty($header_image)) { ?> <!-- header image/slider --> <div class="header_bot header_image"> <div class="container"> <?php $image = new TF_GET_IMAGE(); echo $image->width(960)->height(142)->src($header_image)->get_img(); ?> </div> </div> <!--/ header image/slider --> <?php } else { ?> <div class="header_bot"></div> <?php
/** * Gallery * * To override this shortcode in a child theme, copy this file to your child theme's * theme_config/extensions/shortcodes/shortcodes/ folder. * */ function tfuse_gallery($atts, $content = null) { extract(shortcode_atts(array('before_title' => '', 'population' => 'categories', 'categories' => '', 'posts' => '', 'link' => '#', 'link_text' => ''), $atts)); $out = ''; $terms_ids = explode(",", $categories); $posts_ids = explode(",", $posts); if ($population == 'categories') { $args = array('post_type' => 'portfolio', 'posts_per_page' => 7, 'tax_query' => array(array('taxonomy' => 'group', 'field' => 'id', 'terms' => $terms_ids, 'operator' => 'IN'))); $posts = get_posts($args); } else { $args = array('post_type' => 'portfolio', 'posts_per_page' => 7, 'post__in' => $posts_ids); $posts = get_posts($args); /* for order in initial order */ $term_arr_ord = array(); foreach ($posts_ids as $key => $ord) { foreach ($posts as $unord) { if ($ord == $unord->ID) { $term_arr_ord[$key] = $unord; continue; } } } $posts = $term_arr_ord; } if (!empty($posts)) { $count = 0; $out .= '<section class="grid-gallery">'; foreach ($posts as $post) { ++$count; $permalink = get_permalink($post->ID); if ($count == 1) { $width = 723; $height = 718; $before = '<div class="grid-galley-col1">'; $after = '</div>'; } elseif ($count == 2) { $width = 243; $height = 235; $before = '<div class="grid-galley-col2">'; $after = ''; } elseif ($count == 3) { $width = 243; $height = 235; $before = ''; $after = ''; } elseif ($count == 4) { $width = 243; $height = 235; $before = ''; $after = '</div>'; } elseif ($count == 5) { $width = 358; $height = 355; $before = '<div class="grid-galley-col3">'; $after = ''; } elseif ($count == 6) { $width = 358; $height = 355; $before = ''; $after = '</div>'; } elseif ($count == 7) { $width = 572; $height = 718; $before = '<div class="grid-galley-col4">'; $after = '</div>'; } else { $width = 243; $height = 235; $before = ''; $after = ''; } if (has_post_thumbnail($post->ID)) { $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), '', false, ''); $image = new TF_GET_IMAGE(); $img = $image->width($width)->height($height)->src($src[0])->get_src(); } else { $img = ''; } $out .= $before . '<div class="box box' . $count . ' clearfix" style="background-image:url(' . $img . ')"> <a href="' . $permalink . '" class="box-link-gallery"><strong>' . get_the_title($post->ID) . '</strong><br><span>' . __('VIEW MORE DETAILS', 'tfuse') . '</span></a> </div>' . $after; } $out .= '<div class="rhomb"> <div class="inner">'; if ($before_title != '') { $out .= '<h3 class="rhomb-title-before">' . $before_title . '</h3>'; } $out .= '<h1 class="rhomb-title">' . $content . '</h1>'; if ($link != '') { $out .= '<a href="' . $link . '" class="see-more">' . $link_text . '</a>'; } $out .= '</div> </div> </section>'; } return $out; }
function tfuse_show_similar_posts($id, $post_type) { if ($post_type == 'story') { $tags = wp_get_post_terms($id, 'tags'); } elseif ($post_type == 'service') { $tags = wp_get_post_terms($id, 'tags_service'); } elseif ($post_type == 'advice') { $tags = wp_get_post_terms($id, 'tags_advice'); } elseif ($post_type == 'exercise') { $tags = wp_get_post_terms($id, 'tags_exercises'); } else { $tags = wp_get_post_tags($id); } if (!empty($tags)) { $tags_ids = array(); foreach ($tags as $tag) { $tags_ids[] = $tag->term_id; } if ($post_type == 'story') { $query = new WP_Query(array('post_type' => 'story', 'posts_per_page' => 2, 'post__not_in' => array($id), 'tax_query' => array(array('taxonomy' => 'tags', 'field' => 'id', 'terms' => $tags_ids)))); } elseif ($post_type == 'service') { $query = new WP_Query(array('post_type' => 'service', 'posts_per_page' => 2, 'post__not_in' => array($id), 'tax_query' => array(array('taxonomy' => 'tags_service', 'field' => 'id', 'terms' => $tags_ids)))); } else { $query = new WP_Query(array('post_type' => 'post', 'tag__in' => $tags_ids, 'posts_per_page' => 2, 'post__not_in' => array($id))); } if (!empty($query->posts)) { ?> <section class="post-similar clearfix"> <h6 class="title"><?php _e('You may also like these posts', 'tfuse'); ?> </h6> <?php foreach ($query->posts as $item) { $image = wp_get_attachment_url(get_post_thumbnail_id($item->ID, 'post-thumbnails')); if (!empty($image)) { echo '<a href="' . get_permalink($item->ID) . '"><img src="' . TF_GET_IMAGE::get_src_link($image, 322, 234) . '" /><span>' . strip_tags($item->post_title) . '</span></a>'; } } ?> </section> <?php } } }
function tfuse_shortcode_latest_entry($atts, $content = null) { $out = ''; $recent_post = wp_get_recent_posts(array('numberposts' => 1)); if (!empty($recent_post)) { foreach ($recent_post as $post) { $image = wp_get_attachment_url(get_post_thumbnail_id($post['ID'], 'post-thumbnails')); $get_image = new TF_GET_IMAGE(); $img = $get_image->properties(array('class' => '', 'alt' => get_the_title($post['ID'])))->width(210)->height(210)->src($image)->resize(true)->get_img(); $current_post = get_post($post['ID']); $out .= ' <div class="home-post"> <div class="inner"> <div class="entry-aside"> <header class="entry-header"> <div class="entry-meta"> <div class="cat-links"> <a href="' . get_permalink($post['ID']) . '">' . __('Latest blog entry', 'tfuse') . '</a> </div> <time class="entry-date"><i class="icon-circle"></i>' . get_the_time(get_option('date_format'), $post['ID']) . '</time> <h1 class="entry-title"> <a href="' . get_permalink($post['ID']) . '">' . get_the_title($post['ID']) . '</a> </h1> </div> </header>'; if (!empty($image)) { $out .= '<a class="post-thumbnail" href="' . get_permalink($post['ID']) . '">' . $img . '</a>'; } $out .= '<div class="entry-content"> <p>'; if (tfuse_options('post_content') == 'content') { $out .= $current_post->post_content; } else { $out .= !empty($current_post->post_excerpt) ? $current_post->post_excerpt : strip_tags(tfuse_shorten_string(apply_filters('the_content', $current_post->post_content), 150)); } $out .= '</p> </div> <footer class="entry-meta"> <a href="' . get_permalink($post['ID']) . '" class="btn btn-transparent btn-lets-talk"><span>' . __('Read article', 'tfuse') . ' <i class="icon-chevron-right align-right-icon"></i></span></a> </footer> </div> </div> </div>'; } } return $out; }