Пример #1
0
function mtheme_Thumbnails($atts, $content = null)
{
    extract(shortcode_atts(array("size" => 'thumbnail', "exclude_featured" => 'false', "start" => '', "end" => '', "columns" => '4', "title" => "false", "description" => "false", "id" => '1', "pageid" => ''), $atts));
    // Set a default
    $column_type = "four";
    $portfolioImage_type = "gridblock-small";
    if ($columns == 4) {
        $column_type = "four";
        $portfolioImage_type = "gridblock-small";
    }
    if ($columns == 3) {
        $column_type = "three";
        $portfolioImage_type = "gridblock-medium";
    }
    if ($columns == 2) {
        $column_type = "two";
        $portfolioImage_type = "gridblock-large";
    }
    if ($columns == 1) {
        $column_type = "one";
        $portfolioImage_type = "gridblock-full";
    }
    $portfolio_count = 0;
    $thumbnailcount = 0;
    $thepageID = get_the_id();
    if ($pageid != '') {
        $thepageID = $pageid;
    }
    if ($end < $start) {
        $end = '';
        $start = '';
    }
    $filter_image_ids = mtheme_get_custom_attachments($thepageID);
    if ($filter_image_ids) {
        ob_start();
        echo '<div class="thumbnails-shortcode gridblock-columns-wrap clearfix">';
        echo '<ul class="gridblock-' . $column_type . '">';
        $featuredID = get_post_thumbnail_id();
        foreach ($filter_image_ids as $attachment_id) {
            $thumbnailcount++;
            if ($start != '') {
                if ($thumbnailcount < $start) {
                    continue;
                }
            }
            if ($end != '') {
                if ($thumbnailcount > $end) {
                    continue;
                }
            }
            if ($exclude_featured == 'true') {
                if ($featuredID == $attachment_id) {
                    continue;
                }
                // skip rest of the loop
            }
            $imagearray = wp_get_attachment_image_src($attachment_id, 'fullsize', false);
            $imageURI = $imagearray[0];
            $thumbnail_imagearray = wp_get_attachment_image_src($attachment_id, $portfolioImage_type, false);
            $thumbnail_imageURI = $thumbnail_imagearray[0];
            $imageID = get_post($attachment_id);
            $imageTitle = $imageID->post_title;
            $imageDesc = $imageID->post_content;
            if ($portfolio_count == $columns) {
                $portfolio_count = 0;
            }
            $portfolio_count++;
            if ($portfolio_count == 1) {
                echo '<li class="clearfix"></li>';
            }
            echo '<li class="gridblock-element gridblock-col-' . $portfolio_count . '">';
            echo '<span class="gridblock-thumbnail-image-wrap">';
            echo '<span class="gridblock-link-hover">';
            $linkcenter = "gridblock-link-center";
            echo mtheme_activate_lightbox($lightbox_type = "prettyPhoto", $ID = '', $link = $imageURI, $mediatype = "image", $imagetitle = $imageTitle, $class = "thumbnail-shortcode-columns", $navigation = "prettyPhoto[portfolio]");
            echo '<span class="hover-icon-effect column-gridblock-link ' . $linkcenter . '"><i class="icon-plus"></i></span></a>';
            echo '</span>';
            echo '<span class="gridblock-background-hover"></span>';
            ?>
			<img class="displayed-image" src="<?php 
            echo $thumbnail_imagearray[0];
            ?>
" alt="<?php 
            echo mtheme_get_alt_text($attatchmentID);
            ?>
">
			<?php 
            echo '</span>';
            if ($title == "true" || $description == "true") {
                $portfoliogrid = '<div class="work-details">';
                if ($title == 'true') {
                    $portfoliogrid .= '<h4>';
                    $portfoliogrid .= '' . $imageTitle . '';
                    $portfoliogrid .= '</h4>';
                }
                if ($description == 'true') {
                    $portfoliogrid .= '<p class="entry-content work-description">' . $imageDesc . '</p>';
                }
                $portfoliogrid .= '</div>';
                echo $portfoliogrid;
            }
            ?>
		</li>
			<?php 
        }
        ?>
		</ul>
		</div>

<?php 
        $content = ob_get_contents();
        ob_end_clean();
        return $content;
    }
}
Пример #2
0
/**
 * AJAX Flexi Slideshow .
 *
 * @ [flexislideshow link=(lightbox,direct,none)]
 */
function mtheme_Verticalimages($atts, $content = null)
{
    extract(shortcode_atts(array("id" => '1', "height" => '', "width" => '', "imagesize" => 'portfolio-ajax'), $atts));
    //echo $type, $portfolio_type;
    global $mtheme_thepostID;
    $flexID = "ID" . dechex(time()) . dechex(mt_rand(1, 65535));
    $filter_image_ids = mtheme_get_custom_attachments($mtheme_thepostID);
    $uniqurePageID = dechex(mt_rand(1, 65535));
    if ($filter_image_ids) {
        $output = '
			<ul class="vertical_images clearfix">';
        foreach ($filter_image_ids as $attachment_id) {
            $imagearray = wp_get_attachment_image_src($attachment_id, $imagesize, false);
            $imageURI = $imagearray[0];
            $imageID = get_post($attachment_id);
            $imageTitle = $imageID->post_title;
            $imageCaption = $imageID->post_excerpt;
            $fullimagearray = wp_get_attachment_image_src($attachment_id, '', false);
            $fullimageURI = $fullimagearray[0];
            $output .= '<li>';
            $output .= '<a class="vertical-images-link" rel="prettyPhoto[' . $uniqurePageID . ']" href="' . $fullimageURI . '">';
            $output .= mtheme_showimage($imageURI, $link = "", $resize = false, $height, $width, $quality = MTHEME_IMAGE_QUALITY, $crop = 1, $alt_text = mtheme_get_alt_text($attachment_id), $class = "");
            $output .= '</a>';
            if ($imageTitle != "") {
                $output .= '<div class="vertical-images-title">' . $imageTitle . '</div>';
            }
            $output .= '</li>';
        }
        $output .= '</ul>';
        return $output;
    }
}