Пример #1
0
<?php

global $meta, $portfolio, $post, $post_metam, $page_tpl;
$meta = max_get_cutom_meta_array(get_the_ID());
$embededCode = $meta[MAX_SHORTNAME . '_video_embeded_value'];
$_m4v = !empty($meta[MAX_SHORTNAME . '_video_url_m4v_value']) ? $meta[MAX_SHORTNAME . '_video_url_ogv_value'] : false;
$_ogv = !empty($meta[MAX_SHORTNAME . '_video_url_ogv_value']) ? $meta[MAX_SHORTNAME . '_video_url_ogv_value'] : false;
$_webm = !empty($meta[MAX_SHORTNAME . '_video_url_webm_value']) ? $meta[MAX_SHORTNAME . '_video_url_webm_value'] : false;
// Video Preview is an Imager from an URL
if ($meta[MAX_SHORTNAME . '_video_poster_value'] == 'url') {
    $_poster_url = $meta[MAX_SHORTNAME . '_video_url_poster_value'];
}
// Video Preview is the post featured image or the URL was chosen but not set
if ($meta[MAX_SHORTNAME . '_video_poster_value'] == 'featured' || $meta[MAX_SHORTNAME . '_video_poster_value'] == 'url' && $meta[MAX_SHORTNAME . '_video_poster_value'] == "") {
    $_previewUrl = max_get_image_path($post->ID, 'full');
    // get the imgUrl for showing the post image
    $_poster_url = max_get_custom_image_url(get_post_thumbnail_ID(get_the_ID()), get_the_ID(), MAX_CONTENT_WIDTH, $meta[MAX_SHORTNAME . '_video_height_value']);
}
$width = MAX_CONTENT_WIDTH;
?>

<div class="entry-video-wrapper">
  <div class="entry-video" style="width: 100%">

  <script>// get fitVids if not already included
  if( !jQuery().fitVids ){
    document.write('<script src="<?php 
echo get_template_directory_uri();
?>
/js/jquery.fitvids.min.js"><\/script>');
  }</script>
Пример #2
0
function max_get_timthumb_image($return = false, $p_id = false, $img_size = 'full')
{
    global $post, $imgDimensions, $imgDimensions1x, $p_tpl, $resize_images, $is_retina;
    $max_mobile_detect = new Mobile_Detect();
    // get the sting we need for the different devices
    $size = $img_size;
    // set the attachment image size
    $post_id = !$p_id ? $post->ID : $p_id;
    // check if its a lightbox or a project page link
    $photo_item_type = get_post_meta($post_id, MAX_SHORTNAME . '_photo_item_type_value', true);
    // get the item type
    $imgUrl = max_get_post_image_url($post_id, $size);
    // Get the post image url
    $tpl_show_lightbox = get_post_meta(get_query_var('page_id'), MAX_SHORTNAME . '_disable_post_lightbox', true);
    // check to show the lightbox on this page template
    $use_timthumb = get_option_max('image_use_timthumb');
    $pretty_rel = get_option_max('pretty_enable_lightbox', 'false') == 'false' ? ' data-rel="prettyPhoto"' : '';
    $pretty_rel_gal = get_option_max('pretty_enable_lightbox', 'false') == 'false' ? ' data-rel="prettyPhoto[gal]"' : '';
    // calculate the image dimensions
    if ($max_mobile_detect->isMobile() && !$max_mobile_detect->isTablet() && !empty($imgDimensions1x) && is_array($imgDimensions1x)) {
        // its a mobile phone device so we need other images to display properly
        $_dimensions = max_calculate_image($imgDimensions1x, $imgUrl);
    } else {
        $_dimensions = max_calculate_image($imgDimensions, $imgUrl);
        // desktop images are larger
    }
    // Build the image link
    if (has_post_thumbnail($post_id)) {
        // Get Image URL
        $imgSrc = max_get_image_path($post_id);
        $imgFull = max_get_post_image_url($post_id);
        // get the title
        $title = !get_the_excerpt() ? '' : ' title="' . strip_tags(htmlspecialchars(get_the_excerpt())) . '"';
        $alt = ' alt="' . strip_tags(get_the_title()) . '"';
        $cat_list = array();
        foreach (get_the_category() as $category) {
            $cat_list[] = $category->cat_ID;
        }
        $output = "";
        // check if we have to show a link or links are disabled
        if ($photo_item_type != "Disable Link" && $photo_item_type != 'disable_link') {
            // check if option to show lightbox on this page template is enabled
            if (empty($tpl_show_lightbox) || $tpl_show_lightbox == 'false') {
                if ($photo_item_type == "Lightbox" || $photo_item_type == 'lightbox' || $p_tpl == "template-lightbox.php" || get_option_max('image_always_lightbox') == 'true') {
                    $lightbox_type = get_post_meta($post_id, MAX_SHORTNAME . '_photo_lightbox_type_value', true);
                    $lightbox_link = get_post_meta($post_id, MAX_SHORTNAME . '_photo_item_custom_lightbox', true);
                    if ($p_tpl == "template-lightbox.php") {
                        // check for youtube or vimeo id
                        if ($photo_item_type == 'youtube_embed') {
                            $output .= '<a href="http://www.youtube.com/watch?v=' . get_post_meta($post_id, MAX_SHORTNAME . '_video_embeded_url_value', true) . '"' . $pretty_rel_gal . ' data-link="' . get_permalink($post_id) . '"' . $title . '>';
                        } else {
                            if ($photo_item_type == 'vimeo_embed') {
                                $output .= '<a href="http://www.vimeo.com/' . get_post_meta($post_id, MAX_SHORTNAME . '_video_embeded_url_value', true) . '"' . $pretty_rel_gal . ' data-link="' . get_permalink($post_id) . '"' . $title . '>';
                            } else {
                                if ($photo_item_type == 'selfhosted_embed' || $photo_item_type == 'selfhosted') {
                                    $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_video_url_m4v_value', true) . '?iframe=true" ' . $pretty_rel_gal . ' data-link="' . get_permalink($post_id) . '"' . $title . '>';
                                    // check for lightbox videos
                                } else {
                                    if ($photo_item_type == 'lightbox' && $lightbox_type == 'vimeo') {
                                        $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_photo_video_vimeo_value', true) . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">';
                                    } else {
                                        if ($photo_item_type == 'lightbox' && $lightbox_type == 'youtube') {
                                            $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_photo_video_youtube_value', true) . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">';
                                            // by default get the featured image
                                        } else {
                                            $output .= '<a href="' . $imgFull[0] . '"' . $pretty_rel_gal . ' data-link="' . get_permalink($post_id) . '"' . $title . '>';
                                        }
                                    }
                                }
                            }
                        }
                    } else {
                        // Display Lightbox custom link
                        if (!empty($lightbox_link) && $lightbox_type == 'custom') {
                            $output .= '<a href="' . $lightbox_link . '?iframe=true&amp;width=800&amp;height=600" ' . $pretty_rel . ' data-link="' . get_permalink($post_id) . '"' . $title . '>';
                        }
                        // Display Lightbox Photo
                        if ($lightbox_type == "Photo" || $lightbox_type == "photo") {
                            $output .= '<a href="' . $imgFull[0] . '"' . $pretty_rel_gal . ' data-link="' . get_permalink($post_id) . '"' . $title . '>';
                        }
                        // Display Lightbox YouTube Video
                        if ($lightbox_type == "YouTube-Video" || $lightbox_type == "youtube") {
                            $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_photo_video_youtube_value', true) . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">';
                        }
                        // Display Lightbox Vimeo Video
                        if ($lightbox_type == "Vimeo-Video" || $lightbox_type == "vimeo") {
                            $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_photo_video_vimeo_value', true) . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">';
                        }
                    }
                } else {
                    if ($photo_item_type == "Project Page" || $photo_item_type == 'projectpage' || $photo_item_type == 'selfhosted_embed' || $photo_item_type == 'selfhosted' || $photo_item_type == 'youtube_embed' || $photo_item_type == 'vimeo_embed') {
                        // Photo Type is a Project Page
                        $output .= '<a href="' . get_permalink($post_id) . '"' . $title . '>';
                    } else {
                        if ($photo_item_type == "External Link" || $photo_item_type == 'external') {
                            $target = get_post_meta($post_id, MAX_SHORTNAME . '_external_link_target_value', true);
                            $str_target = isset($target) && $target != "" ? $target : "_blank";
                            // Photo Type is an external Link
                            $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_photo_external_link_value', true) . '" target="' . get_post_meta($post_id, MAX_SHORTNAME . '_external_link_target_value', true) . '"' . $title . '">';
                        } else {
                            // Get the image link
                            $output .= '<a href="' . $imgFull[0] . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">';
                        }
                    }
                }
            }
        }
        // fallback to lightbox if something is wrong to not break the image link
    } else {
        if (empty($tpl_show_lightbox) || $tpl_show_lightbox == 'false') {
            // check if option to show lightbox on this page template is enabled
            // Get the image link
            $output .= '<a href="' . $imgFull[0] . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">';
        }
    }
    // get the new image width calculation if no height or width is set
    if ($_dimensions['height'] == 0) {
        $_dimensions['height'] = "";
    }
    if ($_dimensions['width'] == 0) {
        $_dimensions['width'] = "";
    }
    // resize the image if needed otherwise get the cropped WP version
    if ($resize_images === true) {
        // change to retina image size
        if (!empty($is_retina) && true === $is_retina) {
            $_dimensions['height'] = $_dimensions['height'] * 2;
            $_dimensions['width'] = $_dimensions['width'] * 2;
        }
        $data1x_img = max_get_custom_image_url(get_post_thumbnail_id($post_id), false, $_dimensions['width'], $_dimensions['height'], get_cropping_direction(get_post_meta($post_id, MAX_SHORTNAME . '_photo_cropping_direction_value', true)), false, true);
    } else {
        // lets get the cropped WP version
        // retina size array
        $size_array = array('mobile' => 'large', 'large' => 'full', 'tablet' => 'full', 'full' => 'full');
        // change to retina image size
        if (!empty($is_retina) && true === $is_retina) {
            $size = $size_array[$size];
        }
        $_wp_image = max_get_post_image_url($post_id, $size);
        $data1x_img = $_wp_image[0];
    }
    // get the image tag, it's always the same
    $output .= '<img src="' . $data1x_img . '" ' . $alt . ' data-src="' . $data1x_img . '" class="the-post-image" />';
    // Close Link if its not a disabled link
    if ($photo_item_type != "Disable Link" && $photo_item_type != 'disable_link') {
        if (empty($tpl_show_lightbox) || $tpl_show_lightbox == 'false') {
            // check if option to show lightbox on this page template is enabled
            $output .= '</a>';
        }
    }
    if ($return === true) {
        return $output;
    } else {
        echo $output;
    }
}
Пример #3
0
" />
		<meta property="og:site_name" content="<?php 
        bloginfo('name');
        ?>
" />
		<meta property="og:url" content="<?php 
        echo esc_url(get_permalink());
        ?>
" />
		<meta property="og:locale" content="<?php 
        echo get_option_max('post_social_language');
        ?>
" />
		<?php 
        if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
            $_og_imgURL = max_get_image_path($page_id, 'large');
            ?>
		<meta property="og:image" content="<?php 
            echo esc_url($_og_imgURL);
            ?>
" />
		<meta property="og:image:type" content="image/jpeg" />
		<?php 
        }
        ?>
		<meta property="og:type" content="article" />
		<meta property="og:description"     content="<?php 
        echo esc_attr($meta_desc);
        ?>
" />
Пример #4
0
				<?php 
    // get the page header template part
    locate_template(array('includes/page-header.inc.php'), true, true);
    ?>

				<?php 
    // query posts with arguments from above ($portfolio_args)
    $portfolio_posts = new WP_Query($portfolio_args);
    if ($portfolio_posts->have_posts()) {
        // open galleria container
        $gal_output = '<div id="galleria" class="clearfix">';
        while ($portfolio_posts->have_posts()) {
            $portfolio_posts->the_post();
            // get the url for showing the poster url
            $_stage_url = max_get_image_path(get_the_ID(), 'tablet');
            $_thumbnail_url = max_get_image_path(get_the_ID(), 'thumbnail');
            // get post custom meta
            $_post_meta = max_get_cutom_meta_array(get_the_ID());
            // attach image to output
            $gal_output .= '<a href="' . $_stage_url . '">';
            $gal_output .= '<img title="' . get_the_title() . '"';
            $excerpt = get_the_excerpt();
            if (!empty($excerpt)) {
                $gal_output .= ' alt="' . $excerpt . '"';
            } else {
                $gal_output .= ' alt="' . get_the_title() . '"';
            }
            $gal_output .= ' src="' . $_thumbnail_url . '">
									</a>';
        }
        // close galleria container
Пример #5
0
				<?php 
    /*-----------------------------------------------------------------------------------*/
    /*  Get the needed Slider Template if a slider is selected
    				/*-----------------------------------------------------------------------------------*/
    if (isset($meta[MAX_SHORTNAME . '_photo_slider_select']) && $meta[MAX_SHORTNAME . '_photo_slider_select'] != "" && $meta[MAX_SHORTNAME . '_photo_slider_select'] != "none" && $meta[MAX_SHORTNAME . '_photo_item_type_value'] == "none") {
        // strip of "slider-"
        $slider_tpl = explode("-", $meta[MAX_SHORTNAME . '_photo_slider_select']);
        get_template_part('includes/slider', $slider_tpl[1] . '.inc');
    } else {
        if ($meta[MAX_SHORTNAME . '_photo_item_type_value'] == 'selfhosted' || $meta[MAX_SHORTNAME . '_photo_item_type_value'] == 'youtube_embed' || $meta[MAX_SHORTNAME . '_photo_item_type_value'] == "vimeo_embed") {
            get_template_part('includes/post', 'video.inc');
        } else {
            if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
                // Get the thumbnail
                $imgID = get_post_thumbnail_id();
                $imgUrl_full = max_get_image_path($post->ID, 'full');
                // Check if images should be cropped
                $timb_height = '';
                $timb_img_height = '';
                if (get_option_max('image_blog_detail_original_ratio') != 'true') {
                    $timb_height = 250;
                    if (get_option_max('general_show_fullblog_details', 'false') == 'true') {
                        $timb_height = 354;
                    }
                }
                // get the imgUrl for showing the post image
                $imgUrl = max_get_custom_image_url(get_post_thumbnail_ID(), get_the_ID(), $post_width, $timb_height, get_cropping_direction($meta[MAX_SHORTNAME . '_photo_cropping_direction_value']));
                ?>

					<div class="entry-image">
Пример #6
0
function gallery_custom_columns($column)
{
    global $post;
    switch ($column) {
        case "img_preview":
            // get the post image
            $imgUrl = max_get_image_path($post->ID, 'thumbnail');
            echo '<img src="' . $imgUrl . '" height="60"  alt="' . get_the_title() . '" />';
            break;
        case "description":
            the_excerpt();
            break;
        case "posted":
            echo get_the_date();
            break;
        case "gallery-cat":
            echo get_the_term_list($post->ID, GALLERY_TAXONOMY, '', ', ', '');
            break;
        case 'menu_order':
            $order = $post->menu_order;
            echo $order;
            break;
    }
}
Пример #7
0
                        $data_add .= "\"stretch_video\":\"" . $_video_fill_value . "\"";
                    }
                    $data_add .= "}'";
                    $_tim_width = false;
                    $_img_width = "";
                    // get the imgUrl for showing the post image
                    $_cropping = !empty($_post_meta[MAX_SHORTNAME . '_photo_cropping_direction_value']) ? $_post_meta[MAX_SHORTNAME . '_photo_cropping_direction_value'] : false;
                    $_item_type = !empty($_post_meta[MAX_SHORTNAME . '_photo_item_type_value']) ? str_replace(" ", "_", strtolower($_post_meta[MAX_SHORTNAME . '_photo_item_type_value'])) : "";
                    if (get_option_max('fullsize_use_square') == 'true') {
                        // get the squared images
                        $_tim_width = get_option_max('fullsize_thumb_height');
                        $_img_width = 'width="' . get_option_max('fullsize_thumb_height') . '"';
                        $imgUrl = max_get_custom_image_url(get_post_thumbnail_ID(get_the_ID()), get_the_ID(), $_tim_width, get_option_max('fullsize_thumb_height'), $_cropping);
                    } else {
                        // get the original image url
                        $imgUrl = max_get_image_path(get_the_ID(), 'mobile');
                    }
                    // get the thumbnail height
                    $thumb_height = get_option_max('fullsize_thumb_height');
                    // check if we are on a mobile device to reduce the thumbnail height
                    if ($max_mobile_detect->isMobile() && !$max_mobile_detect->isTablet()) {
                        // only resize if the height is large than 50 to avoid too small thumbnails, otherwise use 50px
                        $thumb_height = $thumb_height / 2 <= 50 ? 50 : get_option_max('fullsize_thumb_height') / 2;
                    }
                    ?>
  								<a <?php 
                    echo $data_add;
                    ?>
 class="item <?php 
                    echo $_item_type . ' ';
                    echo $img_greyscale;
Пример #8
0
function max_get_video_js($post_id)
{
    if (!empty($post_id)) {
        $meta = max_get_cutom_meta_array($post_id);
    }
    // Video Preview is an Imager from an URL
    if ($meta[MAX_SHORTNAME . '_video_poster_value'] == 'url') {
        $_poster_url = $meta[MAX_SHORTNAME . '_video_url_poster_value'];
    }
    // Video Preview is the post featured image or the URL was chosen but not set
    if ($meta[MAX_SHORTNAME . '_video_poster_value'] == 'featured' || $meta[MAX_SHORTNAME . '_video_poster_value'] == 'url' && $meta[MAX_SHORTNAME . '_video_poster_value'] == "") {
        $_imgID = get_post_thumbnail_id(get_the_ID());
        $_previewUrl = max_get_image_path($post_id, 'full');
        // get the imgUrl for showing the post image
        $_poster_url = max_get_custom_image_url(get_post_thumbnail_ID(get_the_ID()), get_the_ID(), MAX_CONTENT_WIDTH);
    }
    $_m4v = $meta[MAX_SHORTNAME . '_video_url_m4v_value'];
    $_ogv = $meta[MAX_SHORTNAME . '_video_url_ogv_value'];
    $_webm = $meta[MAX_SHORTNAME . '_video_url_webm_value'];
    echo do_shortcode('[video width="' . MAX_CONTENT_WIDTH . '" height="' . $meta[MAX_SHORTNAME . '_video_height_value'] . '" mp4="' . $_m4v . '" ogv="' . $_ogv . '" webm="' . $_webm . '" poster="' . $_poster_url . '"  controls="controls">]');
}
Пример #9
0
            // start featured image code here
            if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
                // Get the thumbnail
                $post_image_url = max_get_post_image_url($post_id, 'full');
                $showUrl = $post_image_url[0];
                // Check if images should be cropped
                $timb_height = '';
                $timb_img_height = '';
                if (get_option_max('image_project_original_ratio') != 'true') {
                    $timb_height = 270;
                    $timb_img_height = 'height="270"';
                    // get the imgUrl for showing the post image
                    $imgUrl = max_get_custom_image_url(get_post_thumbnail_ID(), get_the_ID(), MAX_CONTENT_WIDTH, $timb_height, get_cropping_direction($meta[MAX_SHORTNAME . '_photo_cropping_direction_value']));
                } else {
                    // get the default image if we don't have to crop
                    $imgUrl = max_get_image_path(get_the_ID(), 'large');
                }
                ?>

					<div class="entry-image">
						<?php 
                // Check if it is an image or video
                if ($meta[MAX_SHORTNAME . '_photo_lightbox_type_value'] == "YouTube-Video" || $meta[MAX_SHORTNAME . '_photo_lightbox_type_value'] == 'youtube') {
                    $showUrl = $meta[MAX_SHORTNAME . '_photo_video_youtube_value'];
                }
                ?>

						<?php 
                // Check if it is an image or video
                if ($meta[MAX_SHORTNAME . '_photo_lightbox_type_value'] == "Photo" || $meta[MAX_SHORTNAME . '_photo_lightbox_type_value'] == "photo") {
                }