コード例 #1
0
ファイル: menu.php プロジェクト: part-time-project/italians
/**
 * 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;
}
コード例 #2
0
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;
}
コード例 #3
0
/**
 * 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;
}
コード例 #4
0
/**
 * 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;
}
コード例 #5
0
/**
 * 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;
}
コード例 #6
0
ファイル: slideshow.php プロジェクト: shimion/stlucks
/**
 * 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;
}
コード例 #7
0
 /**
  *
  * 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;
 }
コード例 #8
0
 /**
  * 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;
 }
コード例 #9
0
 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;
 }
コード例 #10
0
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;
}
コード例 #11
0
/**
 * 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;
}
コード例 #12
0
ファイル: header-image.php プロジェクト: shimion/stlucks
 * 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 
}
コード例 #13
0
ファイル: TFUSE_MEDIA.php プロジェクト: shimion/stlucks
 /**
  * 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;
     }
 }
コード例 #14
0
/**
 * 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;
}