function wt_get_slide($type = 'full', $layout = '', $set_width = '', $set_height = '') { if ($layout == 'full') { $width = 1140; $left_width = 720; // content width under 991px where the image is displayed at full size } elseif (is_numeric($layout)) { $width = $layout; $left_width = $width; } else { $width = 848; $left_width = 720; // main content width under 991px where the image is displayed at full size } if ($type == 'left') { if ($layout == 'full') { $inline_width = wt_get_option('blog', 'left_width'); // Full Layout - left image inline width $height = wt_get_option('blog', 'left_slide_height'); } else { $inline_width = wt_get_option('blog', 'sidebar_left_width'); // Sidebar Layout - left image inline width $height = wt_get_option('blog', 'sidebar_left_slide_height'); } } else { if ($layout == 'full') { $height = wt_get_option('blog', 'slide_height'); } else { $height = wt_get_option('blog', 'sidebar_slide_height'); } } $uri = THEME_URI; global $post; $html_output = ''; $content = ''; $slide_type = get_post_meta($post->ID, '_slide_type', true); $flex_effect = get_post_meta($post->ID, '_flex_slide_effect', true); $nivo_effect = get_post_meta($post->ID, '_slide_effect', true); if ($slide_type == "flex") { $li = '<li>'; $end_li = '</li>'; } else { $li = ''; $end_li = ''; } if (class_exists('Dynamic_Featured_Image')) { ob_start(); global $dynamic_featured_image; $featured_images = $dynamic_featured_image->get_featured_images($post->ID); if (has_post_thumbnail()) { $image_src_array = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full', true); $image_src = wt_get_image_src($image_src_array[0]); $title = get_post(get_post_thumbnail_id())->post_title; //The Title $alt = get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); //The Alt $caption = get_post(get_post_thumbnail_id())->post_excerpt; //The Caption $description = get_post(get_post_thumbnail_id())->post_content; // The Description } if (!is_null($featured_images)) { // If width / height are set by default when function is called if ($set_width != '') { $width = $set_width; } if ($set_height != '') { $height = $set_height; } if ($type == 'left') { $width = $left_width; // The full width of the image } // The WP Featured Image if (has_post_thumbnail()) { $content .= $li . '<img src="' . aq_resize($image_src, $width, $height, true) . '" alt="' . get_the_title() . '" width="' . $width . '" height="' . $height . '" />' . $end_li; } // The others Dynamic Featured Images foreach ($featured_images as $images) { $image_url = $images['full']; $title = $dynamic_featured_image->get_image_title($image_url); //The (dynamic image) Title $alt = $dynamic_featured_image->get_image_alt($image_url); //The (dynamic image) Alt $caption = $dynamic_featured_image->get_image_caption($image_url); //The (dynamic image) Caption $description = $dynamic_featured_image->get_image_description($image_url); // The (dynamic image) Description $content .= $li . '<img src="' . aq_resize($image_url, $width, $height, true) . '" alt="' . $title . '" width="' . $width . '" height="' . $height . '" />' . $end_li; } } ob_get_clean(); } if ($slide_type == "owl") { wp_print_scripts('owlCarousel'); $html_output .= '<div class="wt_slide_holder wt_owl_rotator" data-owl-autoPlay="7000" data-owl-stopOnHover="true" data-owl-navigation="false" data-owl-slideSpeed="800" data-owl-pagination="true" data-owl-pagSpeed="800" data-owl-autoHeight="true"'; if ($type == 'left') { $html_output .= 'style="width:' . $inline_width . 'px"'; } $html_output .= '>'; $html_output .= $content; $html_output .= '</div>'; } elseif ($slide_type == "nivo") { wp_print_scripts('nivo'); $html_output .= '<div class="wt_slide_holder nivo_container"'; if ($type == 'left') { $html_output .= ' style="width:' . $inline_width . 'px"'; } $html_output .= '>' . '<div class="nivoslider_wrap" data-nivo_effect="' . $nivo_effect . '" data-nivo_slices="10" data-nivo_boxCols="8" data-nivo_boxRows="4" data-nivo_animSpeed="500" data-nivo_pauseTime="7000" data-nivo_directionNav="true" data-nivo_controlNav="true" data-nivo_controlNavThumbs="false" data-nivo_pauseOnHover="true" data-nivo_manualAdvance="false">' . $content . '</div></div>'; } else { wp_print_scripts('flex'); $html_output .= '<div class="wt_slide_holder flex_container"'; if ($type == 'left') { $html_output .= ' style="width:' . $inline_width . 'px"'; } $html_output .= '>' . '<div class="flexslider_wrap flexslider" data-flex_animation="' . $flex_effect . '" data-flex_easing="easeOutCirc" data-flex_direction="horizontal" data-flex_animationSpeed="800" data-flex_slideshowSpeed="7000" data-flex_directionNav="true" data-flex_controlNav="true" data-flex_controlNavThumbs="false" data-flex_controlNavThumbsSlider="false" data-flex_pauseOnAction="true" data-flex_pauseOnHover="true" data-flex_slideshow="true" data-flex_animationLoop="true">'; $html_output .= '<ul class="slides">' . "\n\t\t\t"; $html_output .= $content; $html_output .= '</ul>' . "\n\t\t\t"; $html_output .= '</div></div>'; } return $html_output; }
function wt_staticImage($type) { if (has_post_thumbnail()) { $image_src_array = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full', true); $featured_image = wt_get_image_src($image_src_array[0]); } if (!empty($featured_image) && $type == 'static_image') { $staticImg = $featured_image; } else { $staticImg = wt_get_option('introheader', 'static_image'); } $width = 980; $static_adaptive_height = wt_get_option('introheader', 'static_adaptive_height'); if ($static_adaptive_height) { $height = floor($width * ($image_src_array[2] / $image_src_array[1])); } else { $height = wt_get_option('introheader', 'static_image_height'); } $lightbox = '<a href="' . $staticImg . '" data-rel="lightbox" title="' . get_the_title() . '">'; $image_src = aq_resize($staticImg, $width, $height, true); //resize & crop img ?> <header id="wt_intro"> <div class="container"> <div class="intro_staticImage"> <?php echo wt_get_option('introheader', 'static_image_lightbox') ? $lightbox : ''; ?> <img src="<?php echo $image_src; ?> " alt="<?php the_title(); ?> " /> <?php echo wt_get_option('introheader', 'static_image_lightbox') ? '</a>' : ''; ?> </div> </div> </header> <?php }
?> " /> <?php } if ($favicon_114 = wt_get_option('general', 'favicon_114')) { ?> <link rel="apple-touch-icon" sizes="114x114" href="<?php echo wt_get_image_src($favicon_114); ?> " /> <?php } if ($favicon_144 = wt_get_option('general', 'favicon_144')) { ?> <link rel="apple-touch-icon" sizes="144x144" href="<?php echo wt_get_image_src($favicon_144); ?> " /> <?php } ?> <!--[if lt IE 10]> <style type="text/css"> html:not(.is_smallScreen) .wt_animations .wt_animate { visibility:visible;} </style> <![endif]--> <?php wp_head(); ?> </head> <?php
protected function WT_VCSC_PortfolioList($options, $id) { global $wp_filter; $the_content_filter_backup = $wp_filter['the_content']; $options = shortcode_atts(array('columns' => 4, 'grid_spaces' => 'false', 'overlay_desc' => 'false', 'max' => -1, 'pagination' => 'false', 'pagination_align' => 'center', 'sortable' => 'false', 'carousel' => 'false', 'auto_slide' => 0, 'carousel_nav' => 'false', 'title' => 'true', 'title_linkable' => 'true', 'excerpt' => 'false', 'excerpt_length' => 15, 'full' => 'false', 'category' => 'true', 'group' => 'true', 'ids' => '', 'cat' => '', 'cat__not' => '', 'order' => 'DESC', 'orderby' => 'date', 'read_more' => 'true', 'read_more_text' => __('Read more', 'wt_vcsc')), $options); extract($options); $output = ''; $rel_group = 'portfolio_' . $id; // for lightbox group if ($read_more == 'true') { $read_more = true; } else { $read_more = false; } // Automatically disable sortable or pagination if they all are true by mistake if ($carousel == "true") { $sortable = 'false'; $pagination = 'false'; } if ($sortable == "true") { $pagination = 'false'; } if ($pagination == 'true') { global $wp_version; if (is_front_page() && version_compare($wp_version, "3.1", '>=')) { //fix wordpress 3.1 paged query $paged = get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1); } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } } else { $paged = NULL; } // Display only selected portfolios if ($ids) { $portfolio_ids = explode(',', $ids); } else { $portfolio_ids = NULL; } // Include categories if (!empty($cat)) { $include_categories = array('taxonomy' => 'wt_portfolio_category', 'field' => 'slug', 'terms' => explode(',', $cat), 'operator' => 'IN'); } else { $include_categories = ''; } // Exclude categories if (!empty($cat__not)) { $exclude_categories = array('taxonomy' => 'wt_portfolio_category', 'field' => 'slug', 'terms' => explode(',', $cat__not), 'operator' => 'NOT IN'); } else { $exclude_categories = ''; } $wt_query = new WP_Query(array('post_type' => 'wt_portfolio', 'posts_per_page' => $max, 'paged' => $paged, 'order' => $order, 'orderby' => $orderby, 'post__in' => $portfolio_ids, 'tax_query' => array('relation' => 'AND', $include_categories, $exclude_categories))); $i = 1; $order = 0; while ($wt_query->have_posts()) { $order++; $wt_query->the_post(); $terms = get_the_terms(get_the_id(), 'wt_portfolio_category'); $terms_slug = array(); if (is_array($terms)) { foreach ($terms as $term) { $terms_slug[] = $term->slug; } } if (has_post_thumbnail()) { $image_id = get_post_thumbnail_id(get_the_id()); $image = wp_get_attachment_image_src($image_id, 'full', true); $type = get_post_meta(get_the_id(), '_portfolio_type', true); $iframe = ''; $video_width = $video_height = ''; // if portfolio type - image if ($type == 'image') { // if no large image link is set then get the featured image $href = get_post_meta(get_the_id(), '_image', true); if (empty($href)) { $href = $image[0]; } $icon = '<i class="fa-picture-o"></i>'; $lightbox = ' lightbox'; if ($group == 'true') { $rel = ' data-rel="lightbox[' . $rel_group . ']"'; } else { $rel = ''; } // if portfolio type - video } elseif ($type == 'video') { // if no video link is set then get the featured image $href = get_post_meta(get_the_id(), '_video', true); if (empty($href)) { $href = $image[0]; } $video_width = get_post_meta(get_the_id(), '_video_width', true); $video_height = get_post_meta(get_the_id(), '_video_height', true); if ($video_width) { $video_width = '?width=' . $video_width . ''; } if ($video_height) { if ($video_width) { $video_height = '&height=' . $video_height . ''; } else { $video_height = '?height=' . $video_height . ''; } } $icon = '<i class="fa-youtube-play"></i>'; $lightbox = ' lightbox'; if ($group == 'true') { $rel = ' data-rel="lightbox[' . $rel_group . ']"'; } else { $rel = ''; } // if portfolio type - link } elseif ($type == 'link') { $link = get_post_meta(get_the_ID(), '_portfolio_link', true); $href = wt_get_superlink($link); $link_target = get_post_meta(get_the_ID(), '_portfolio_link_target', true); $link_target = $link_target ? $link_target : '_self'; $icon = '<i class="fa-link"></i>'; $lightbox = ''; $rel = ''; // if portfolio type - document } else { $href = get_permalink(); $link_target = get_post_meta(get_the_ID(), '_doc_target', true); $link_target = $link_target ? $link_target : '_self'; $icon = '<i class="fa-file-text"></i>'; $lightbox = ''; $rel = ''; } } /* End if (has_post_thumbnail() */ if ($carousel == 'true') { $output .= '<div class="item">'; } if ($columns == 1) { $output .= '<article data-order="' . $order . '" id="post-' . get_the_ID() . '" class="portEntry">'; $output .= '<header class="wt_portofolio_item wt_two_third ' . implode(' ', $terms_slug) . '">'; } else { // $columns==2 || $columns==3 || $columns==4 || $columns==6 $output .= '<article data-order="' . $order . '" id="post-' . get_the_ID() . '" class="portEntry wt_portofolio_item'; $output .= ' ' . implode(' ', $terms_slug) . '">'; $output .= '<div class="wt_portofolio_container">'; } switch ($columns) { case 1: // portfolio one column $width = '620px'; $height = '312px'; break; case 2: // portfolio two columns $width = '730px'; $height = '465px'; $width_inline = '730'; $height_inline = '654'; break; case 3: // portfolio three columns $width = '730px'; $height = '465px'; $width_inline = '730'; $height_inline = '465'; break; case 6: // portfolio six columns // portfolio six columns case 5: // portfolio five columns // portfolio five columns case 4: // portfolio four columns // portfolio four columns default: $width = '480px'; $height = '305px'; $width_inline = '480'; $height_inline = '305'; } if (has_post_thumbnail()) { $output .= '<figure class="wt_image_frame">'; $output .= '<span class="wt_image_holder">'; $output .= '<img src="' . aq_resize(wt_get_image_src($image[0]), $width, $height, true) . '" alt="' . get_the_title() . '" width="' . $width_inline . '" height="' . $height_inline . '" />'; if ($overlay_desc == 'false') { // if overlay title / excerpt is false $output .= '<span class="wt_image_overlay"></span>'; $output .= '<a class="wt_icon_lightbox" ' . (isset($link_target) ? 'target="' . $link_target . '" ' : '') . ' ' . $rel . ' href="' . $href . $video_width . $video_height . '" title="' . get_the_title() . '">' . $icon . '</a>'; } $output .= '</span>'; $output .= '</figure>'; } /* End if (has_post_thumbnail() */ if ($columns == 1) { $output .= '</header>'; // End header - "wt_portofolio_item" $output .= '<div class="wt_portofolio_item wt_one_third last'; $output .= ' ' . $term->slug . '">'; } if ($columns != 1 && ($excerpt == 'true' || $title == 'true' || $category == 'true' || $read_more == true)) { $output .= '<div class="wt_portofolio_details">'; if ($overlay_desc == 'true') { // if overlay title / excerpt is true $output .= '<a class="wt_icon_lightbox" ' . (isset($link_target) ? 'target="' . $link_target . '" ' : '') . ' ' . $rel . ' href="' . $href . $video_width . $video_height . '" title="' . get_the_title() . '">' . $icon . '</a>'; } } // If portfolio title if ($title == 'true') { if ($title_linkable == 'true') { $output .= '<h4 class="wt_portfolio_title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h4>'; } else { $output .= '<h4 class="wt_portfolio_title">' . get_the_title() . '</h4>'; } } // If excerpt, category or read_more then build "wt_portofolio_det" wrapper if ($excerpt == 'true' || $category == 'true' || $read_more == true) { $output .= '<div class="wt_portofolio_det">'; } // if category is set to Yes if ($category == 'true') { $output .= '<p class="wt_portfolioCategory">' . $term->name . '</p>'; } // if excerpt is set to Yes if ($excerpt == 'true') { /* Display all post content or post excerpt */ if ($full == 'true') { $read_more = false; $content = get_the_content(); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $output .= $content; } else { $content = WT_VCSC_Excerpt($excerpt_length, false, $read_more_text); $output .= '<div class="wt_portfolio_excerpt">' . $content . '</div>'; } } // if read_more is set to Yes if ($read_more == true) { $more_link = wt_get_superlink(get_post_meta(get_the_id(), '_portfolio_link', true), get_permalink()); $more_link_target = get_post_meta(get_the_ID(), '_portfolio_link_target', true); $more_link_target = $more_link_target ? $more_link_target : '_self'; $readmore_link = '<p class="wt_portf_readmore"><a href="' . $more_link . '" target="' . $more_link_target . '" title="' . $read_more_text . '" rel="bookmark" class="read_more_link">' . $read_more_text . ' <span class="wt-readmore-rarr">»</span></a></p>'; $output .= apply_filters('wt_readmore_link', $readmore_link); } if ($excerpt == 'true' || $category == 'true' || $read_more == true) { $output .= '</div>'; // End div - "wt_portofolio_det" } if ($columns != 1 && ($excerpt == 'true' || $title == 'true' || $category == 'true' || $read_more == true)) { $output .= '</div>'; // End div - "wt_portofolio_details" } if ($columns == 1) { $output .= '</div>'; // End div - "wt_portofolio_item" } else { // $columns==2 || $columns==3 || $columns==4 || $columns==6 $output .= '</div>'; // End div - "wt_portofolio_container" } $output .= '</article>'; // End portfolio article if ($carousel == 'true') { $output .= '</div>'; // End "item" div } } if ($carousel == 'true') { $output .= '</div>'; // End "wt_owl_carousel" div $output .= '</div>'; // End "wt_port_carousel" div } if ($pagination == 'true' && $carousel == 'false') { ob_start(); WT_VCSC_PortfolioPageNavi('', '', $wt_query, $paged, $pagination_align); $output .= ob_get_clean(); } wp_reset_postdata(); $wp_filter['the_content'] = $the_content_filter_backup; return $output; }