Beispiel #1
0
function image_func($atts, $content = null)
{
    extract(shortcode_atts(array('animation' => '', 'size' => '', 'align' => ''), $atts));
    //wordpress is replacing "x" with special character in strings like 1920x1080
    //we have to bring back our "x"
    $content = str_replace('×', 'x', $content);
    $class = 'wp-post-image animated ' . $align . ' ' . $animation . ' ' . $size;
    switch ($size) {
        case 'full':
            return ts_get_resized_image_sidebar($content, array('full', 'one-sidebar', 'two-sidebars'), '', $class);
            break;
        case 'half':
            return ts_get_resized_image_sidebar($content, array('half-full', 'half-one-sidebar', 'half-two-sidebars'), '', $class);
            break;
        case 'one_third':
            return ts_get_resized_image_sidebar($content, array('third-full', 'third-one-sidebar', 'third-two-sidebars'), '', $class);
            break;
        case 'one_fourth':
            return ts_get_resized_image_sidebar($content, array('fourth-full', 'fourth-one-sidebar', 'fourth-two-sidebars'), '', $class);
            break;
        default:
            return '<img src="' . $content . '" class="' . $class . '">';
            break;
    }
}
function image_item_func($atts, $content = null)
{
    extract(shortcode_atts(array('url' => '', 'target' => ''), $atts));
    //wordpress is replacing "x" with special character in strings like 1920x1080
    //we have to bring back our "x"
    $content = str_replace('&#215;', 'x', $content);
    $item = '<li>';
    $image = $content;
    $image = ts_get_resized_image_sidebar($image, array('full', 'one-sidebar', 'two-sidebars'));
    if (!empty($url)) {
        $item .= '<a href="' . $url . '" ' . (!empty($target) ? 'target="' . $target . '"' : '') . '>' . $image . '</a>';
    } else {
        $item .= $image;
    }
    $item .= '</li>';
    return $item;
}
?>
>
	<?php 
$thumb = '';
switch (get_post_format()) {
    case 'gallery':
        $gallery = get_post_meta($post->ID, 'gallery_images', true);
        if (is_array($gallery) && count($gallery) > 0) {
            ?>



			<?php 
            $thumb = "\n\t\t\t\t<div class='facilities visible-on-hover'>\n\t\t\t\t\t<div class='gallery-image-links'>\n\t\t\t\t\t\t<a class='prev' title='" . __('Previous', 'circles') . "' href='#' id='prev-" . $post->ID . "'>\n\t\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t\t<span class='tran03slinear'></span>\n\t\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t\t<a class='next' title='" . __('Next', 'circles') . "' href='#' id='next-" . $post->ID . "'>\n\t\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t\t<span class='tran03slinear'></span>\n\t\t\t\t\t\t\t<span></span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</div>\n\t\t\t\t\t<a class='image-link' rel='prettyPhoto' title='Sed diam nonumy' href='http://circles.arenaofthemes.com/wp-content/uploads/2013/03/smaller_size-3.jpg'><span class='zoom'></span></a>\n\t\t\t\t</div>\n\t\t\t\t\t<div class='flexslider' id='flexslider-" . $post->ID . "'>\n\t\t\t\t\t\t<ul class='slides'>";
            foreach ($gallery as $image) {
                $thumb .= "<li>" . ts_get_resized_image_sidebar($image['image'], array('full', 'one-sidebar', 'two-sidebars'), $image['title']) . "</li>";
            }
            $thumb .= "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t  </div>\n\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\tjQuery(document).ready(function() {\n\t\t\t\t\t\t  jQuery('#flexslider-" . $post->ID . "').flexslider({\n\t\t\t\t\t\t\tanimation: 'slide',\n\t\t\t\t\t\t\tcontrolNav: false,\n\t\t\t\t\t\t\tprevText: \"" . ts_get_prev_slider_text() . "\",\n\t\t\t\t\t\t\tnextText: \"" . ts_get_next_slider_text() . "\"\n\t\t\t\t\t\t  });\n\t\t\t\t\t\t});\n\t\t\t\t\t\tjQuery('#prev-" . $post->ID . "').click(function(){\n\t\t\t\t\t\t\tjQuery('#flexslider-" . $post->ID . "').flexslider('prev');\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tjQuery('#next-" . $post->ID . "').click(function(){\n\t\t\t\t\t\t\tjQuery('#flexslider-" . $post->ID . "').flexslider('next');\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t</script>";
        }
        break;
    case 'video':
        $url = get_post_meta($post->ID, 'video_url', true);
        if (!empty($url)) {
            $thumb = ts_get_embaded_video($url);
        } else {
            if (empty($url)) {
                $thumb = get_post_meta($post->ID, 'embedded_video', true);
            }
        }
        $thumb = '<div class="videoWrapper">' . $thumb . '</div>';
        break;
/**
 * Display resized image, checks for sidebars and choose best resolution
 * @global type $post
 * @param string $image image url, must be from media library
 * @param array $sizes array of 3 sizes, 0 - no sidebars, 1 - one siedebar, 2 - two siedbars, eg. array('600,300','400,200','300,150')
 * @param string $alt
 * @param string $class
 * @return void
 * @since framework 1.0
 */
function ts_the_resized_image_sidebar($image, $sizes, $alt = '', $class = '')
{
    echo ts_get_resized_image_sidebar($image, $sizes, $alt, $class);
}
/**
 * Get circles thumbnail (image,gallery slider or video), must be run in loop
 * @global object $post
 * @param array $sizes different sizes for page without or with one or two sidebars
 * @return string
 */
function ts_get_circles_thumb($sizes)
{
    global $post;
    $thumb = '';
    switch (get_post_format()) {
        case 'gallery':
            $gallery = get_post_meta($post->ID, 'gallery_images', true);
            if (is_array($gallery) && count($gallery) > 0) {
                $thumb = "\n\t\t\t\t\t<div class='flexslider' id='flexslider-" . $post->ID . "'>\n\t\t\t\t\t\t<ul class='slides'>";
                foreach ($gallery as $image) {
                    $thumb .= "<li>" . ts_get_resized_image_sidebar($image['image'], $sizes, $image['title']) . "</li>";
                }
                $thumb .= '
						</ul>
					  </div>
					<script type="text/javascript">
						jQuery(document).ready(function() {
						  jQuery("#flexslider-' . $post->ID . '").flexslider({
							animation: "slide",
							controlNav: false,
							prevText: "' . ts_get_prev_slider_text() . '",
							nextText: "' . ts_get_next_slider_text() . '"
						  });
						});
					</script>';
            }
            break;
        case 'video':
            $url = get_post_meta($post->ID, 'video_url', true);
            if (!empty($url)) {
                $thumb = ts_get_embaded_video($url);
            } else {
                if (empty($url)) {
                    $thumb = get_post_meta($post->ID, 'embedded_video', true);
                }
            }
            $thumb = '<div class="videoWrapper">' . $thumb . '</div>';
            break;
        default:
            $thumb = ts_get_resized_post_thumbnail_sidebar($post->ID, $sizes, get_the_title());
            break;
    }
    return $thumb;
}