$slide_has_video = true;
            } elseif (!empty($vimeo_id)) {
                $the_video = '<iframe class="vimeo_frame" id="video_' . get_the_ID() . '" src="http://player.vimeo.com/video/' . $vimeo_id . '?api=1&player_id=player_' . get_the_ID() . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
                $slide_has_video = true;
            } elseif (!empty($video_embed)) {
                $slide_has_video = true;
                $the_video = '<div class="video-wrap">' . stripslashes(htmlspecialchars_decode($video_embed)) . '</div>';
            } else {
                $video_m4v = get_post_meta(get_the_ID(), '_senna_video_m4v', true);
                $video_webm = get_post_meta(get_the_ID(), '_senna_video_webm', true);
                $video_ogv = get_post_meta(get_the_ID(), '_senna_video_ogv', true);
                $video_poster = get_post_meta(get_the_ID(), '_senna_video_poster', true);
                if (!empty($video_m4v) || !empty($video_webm) || !empty($video_ogv) || !empty($video_poster)) {
                    $slide_has_video = true;
                    ob_start();
                    wpGrade_video_selfhosted(get_the_ID());
                    $the_video = ob_get_clean();
                }
            }
            ?>
                                <div class="container">
                                    <div class="row">
                                        <div class="slide-content <?php 
            if ($slide_has_video) {
                echo 's-video';
            }
            ?>
">

                                            <?php 
            if ($slide_has_video) {
Example #2
0
function portfolio_single_gallery($postID)
{
    if (get_post_format($postID) == 'video') {
        $video_embed = get_post_meta($postID, '_senna_video_embed', true);
        if (!empty($video_embed)) {
            echo '<div class="video-wrap-singleproject">' . stripslashes(htmlspecialchars_decode($video_embed)) . '</div>';
        } else {
            echo '<div class="audio-wrap-singleproject">';
            wpGrade_video_selfhosted($postID);
            echo '</div>';
        }
    }
    if (get_post_format($postID) == 'audio') {
        echo '<div class="audio-wrap-singleproject">';
        wpGrade_audio_selfhosted($postID);
        echo '</div>';
    }
    ?>

    <div class="portfolio_single_gallery">

        <ul>

            <?php 
    // get the big image
    $video_poster = get_post_meta(get_the_ID(), '_senna_video_poster', true);
    if (!empty($video_poster) && get_post_format() == 'video') {
        global $wpdb;
        $uploads_dir_info = wp_upload_dir();
        $temp_poster = str_replace($uploads_dir_info['baseurl'] . '/', '', $video_poster);
        $video_poster_id = $wpdb->get_var($wpdb->prepare("SELECT wposts.ID FROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $temp_poster));
    }
    if (has_post_thumbnail($postID)) {
        $featured_image_id = get_post_thumbnail_id($postID);
        $featured_image = get_post($featured_image_id);
        $exclude_ids = $featured_image_id;
        if (!empty($video_poster_id) && $featured_image_id != $video_poster_id) {
            $exclude_ids .= ',' . $video_poster_id;
        }
        //get the rest of the gallery without the featured image
        $attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => $postID, 'exclude' => $exclude_ids));
    } else {
        if (!empty($video_poster_id)) {
            //get all the images in the gallery except the video poster
            $attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => $postID, 'exclude' => $video_poster_id));
        } else {
            //get all the images in the gallery
            $attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => $postID));
        }
        //we use the first image in the gallery for the big one
        if (!empty($attachments[0])) {
            $featured_image = $attachments[0];
            //delete the first image from the array
            array_shift($attachments);
        }
    }
    if (!empty($featured_image)) {
        //put the big one in place
        $image_src = wp_get_attachment_image_src($featured_image->ID, 'project-big');
        $image_full_src = wp_get_attachment_image_src($featured_image->ID, 'full');
        $image_alt = get_post_meta($featured_image->ID, '_wp_attachment_image_alt', true);
        if (empty($image_alt)) {
            $image_alt = $featured_image->post_title;
        }
        $image_caption = $featured_image->post_excerpt;
        echo '<li class="big" ><a class="popup" href="' . $image_full_src[0] . '" title="' . $featured_image->post_title . '">

									<div class="title"><div><span>+</span></div></div>

									<div class="border"><span></span></div>

									<img src="' . $image_src[0] . '" alt="' . $image_alt . '" itemprop="image" />

								</a></li>';
        //also calculate the height factor of the big image
        $featured_height_factor = 2 * 100 * $image_src[2] / $image_src[1];
    } else {
        $featured_height_factor = 0;
    }
    if (!empty($attachments)) {
        $height_factor_sum = 0;
        //lets go through the attachment images
        foreach ($attachments as $attachment) {
            //get the image data
            $image_src = wp_get_attachment_image_src($attachment->ID, 'project-small');
            $image_full_src = wp_get_attachment_image_src($attachment->ID, 'full');
            $image_alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true);
            if (empty($image_alt)) {
                $image_alt = $attachment->post_title;
            }
            $image_caption = $attachment->post_excerpt;
            // if we still have space on the right of the featured image, put more small images
            // we still put an image if more than 75% of the right image fits
            if ($height_factor_sum < $featured_height_factor && $featured_height_factor - $height_factor_sum > 100 * $image_src[2] / $image_src[1] * 0.5) {
                //we make small images
                echo '<li class="small"><a class="popup" href="' . $image_full_src[0] . '" title="' . $attachment->post_title . '">

									<div class="title"><div><span>+</span></div></div>

									<div class="border"><span></span></div>

									<img src="' . $image_src[0] . '" alt="' . $image_alt . '" />

								</a></li>';
            } else {
                //we make half size images
                echo '<li class="medium"><a class="popup" href="' . $image_full_src[0] . '" title="' . $attachment->post_title . '">

									<div class="title"><div><span>+</span></div></div>

									<div class="border"><span></span></div>

									<img src="' . $image_src[0] . '" alt="' . $image_alt . '" />

								</a></li>';
            }
            //update the height_factor_sum by adding that of the current image
            $height_factor_sum += 100 * $image_src[2] / $image_src[1];
        }
    }
    ?>

        </ul>

    </div>

<?php 
}
Example #3
0
    ?>
</a></h2>
	<?php 
}
?>
	<div class="posted-on"><?php 
wpgrade_posted_on();
?>
 / 
		<div class="categories"><?php 
$categories = get_the_category();
$separator = ' / ';
$output = '';
if ($categories) {
    foreach ($categories as $category) {
        $output .= '<a href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", wpGrade_txtd), $category->name)) . '">' . $category->cat_name . '</a>' . $separator;
    }
    echo trim($output, $separator);
}
?>
		</div>
	</div>
</header><!-- .entry-header -->
							
<?php 
$video_embed = get_post_meta($post->ID, '_senna_video_embed', true);
if (!empty($video_embed)) {
    echo '<div class="video-wrap">' . stripslashes(htmlspecialchars_decode($video_embed)) . '</div>';
} else {
    wpGrade_video_selfhosted($post->ID);
}