Esempio n. 1
0
									<h2 class="entry-title"><a href="<?php 
        the_permalink();
        ?>
" title="title="<?php 
        echo htmlspecialchars(get_the_excerpt());
        ?>
""><?php 
        the_title();
        ?>
</a></h2>

									<?php 
        if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
            // get the imgUrl for showing the post image
            $imgUrl = max_get_custom_image_url(get_post_thumbnail_ID(), get_the_ID(), MAX_CONTENT_WIDTH, 350, $post_meta[MAX_SHORTNAME . '_photo_cropping_direction_value']);
            ?>

									<div class="entry-image">
										<a href="<?php 
            the_permalink();
            ?>
" title="<?php 
            the_title();
            ?>
">
											<img src="<?php 
            echo $imgUrl;
            ?>
" height="350" width="<?php 
            echo MAX_CONTENT_WIDTH;
Esempio n. 2
0
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>
Esempio n. 3
0
 function max_get_slider_image($_meta, $img_slug = 'full', $sort = 0, $return = false, $greyscale = false, $crop = false, $_height = 400)
 {
     // Get Image URL
     $theImageSrc = wp_get_attachment_image_src($_meta['imgID'], $img_slug);
     global $blog_id, $meta;
     $output = "";
     $cat_list = array();
     $imgWidth = '';
     $width = MAX_CONTENT_WIDTH;
     // get the new proportional image height
     if ($theImageSrc[1] >= MAX_CONTENT_WIDTH) {
         $newHeight = $theImageSrc[2] * (MAX_CONTENT_WIDTH / $theImageSrc[1]);
     } else {
         $newHeight = $theImageSrc[2];
     }
     $height = $_height === false ? $newHeight : $_height;
     if ($img_slug == 'slides-slider') {
         $width = $theImageSrc[1];
         $height = $theImageSrc[2];
     }
     foreach (get_the_category() as $category) {
         $cat_list[] = $category->cat_ID;
     }
     // check greyscale images
     $greyscale = $greyscale == "true" ? "&f=2" : "";
     // output the link and the image
     $_link = wp_get_attachment_url($_meta['imgID']);
     $_add = ' data-rel="prettyPhoto[gal-' . get_the_ID() . ']"';
     // check title
     $title = isset($_meta['showtitle']) && $_meta['showtitle'] == 'true' ? ' title="' . get_the_title() . '"' : ($title = "");
     $_cropping = !empty($_meta['cropping']) ? $_meta['cropping'] : "c";
     $img_url = max_get_custom_image_url($_meta['imgID'], false, $width, $height, $_cropping, false, true);
     // check if lightbox should be shown
     if (@$meta[MAX_SHORTNAME . '_photo_lightbox'] != 'true') {
         $output .= '<a href="' . $_link . '" ' . $title . $_add . ' data-link="' . get_permalink() . '">';
     }
     $output .= '<img src="' . $img_url . '" alt="' . htmlspecialchars(get_the_excerpt()) . '"' . $imgWidth . ' />';
     // check if lightbox should be shown
     if (@$meta[MAX_SHORTNAME . '_photo_lightbox'] != 'true') {
         $output .= '</a>';
     }
     if ($return === true) {
         return $output;
     } else {
         echo $output;
     }
 }
Esempio n. 4
0
function related_posts_shortcode($atts)
{
    extract(shortcode_atts(array('limit' => '4', 'width' => 400, 'height' => 300, 'taxonomy' => GALLERY_TAXONOMY), $atts));
    global $post, $imgDimensions;
    $imgDimensions = array('width' => $width, 'height' => $height);
    if ($post->ID) {
        // Get tags
        $filter = 'post_tag';
        $tags = wp_get_post_terms($post->ID, 'post_tag', array("fields" => "ids"));
        $list = "";
        $tag_arr = "";
        if ($tags) {
            $args = array('tag__in' => $tags, 'post__not_in' => array($post->ID), 'post_type' => get_post_type(), 'showposts' => $limit, 'ignore_sticky_posts' => 1);
            $related_posts = new WP_Query($args);
            if ($related_posts) {
                $list = '<div id="related-posts" class="entry-related-images portfolio-four-columns"><h3 class="related-title">' . __('Related Posts', MAX_SHORTNAME) . '</h3><ul class="clearfix portfolio-list">';
                if ($related_posts->have_posts()) {
                    while ($related_posts->have_posts()) {
                        $related_posts->the_post();
                        if (has_post_thumbnail(get_the_ID())) {
                            $hover_class = "";
                            if (get_option_max('image_show_fade') != "true") {
                                $hover_class = ' no-hover';
                            }
                            $list .= '<li class="item ' . max_get_post_lightbox_class() . $hover_class . '"><div class="shadow">';
                            // get the imgUrl for showing the post image
                            $_imgUrl = max_get_custom_image_url(get_post_thumbnail_ID(get_the_ID()), get_the_ID(), esc_attr($width), esc_attr($height), get_cropping_direction(get_post_meta(get_the_ID(), MAX_SHORTNAME . '_photo_cropping_direction_value', true)));
                            // get the gallery item
                            $list .= '<a href="' . get_permalink(get_the_ID()) . '" title="' . get_the_title() . '"><img src="' . $_imgUrl . '" alt="' . get_the_title() . '" /></a></div>';
                            // check if caption option is selected
                            if (get_option_max('image_show_caption') == 'true') {
                                $list .= '<div class="item-caption"><strong>' . wptexturize(get_the_title()) . '</strong></div>';
                            }
                            $list .= '</li>';
                        } else {
                            continue;
                        }
                    }
                }
                wp_reset_query();
                $list .= '</ul></div>';
            }
        }
        return $list;
    }
    return;
}
Esempio n. 5
0
        } 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">

					  <?php 
                $img_excerpt = get_the_excerpt();
                $img_title = get_the_title();
                $img_alt = get_the_title();
                // check wether to choose image or post meta informations on the lightbox
                if (get_option_max('general_use_image_meta') == 'true') {
                    // get the meta from the image information on the media library
                    $img_title = get_post_field('post_title', get_post_thumbnail_id());
                    $img_excerpt = get_post_field('post_excerpt', get_post_thumbnail_id());
                    $img_alt = get_post_field('_wp_attachment_image_alt', get_post_thumbnail_id());
                }
                       $data_add .= ",\"url_m4v\":\"" . $_video_url_m4v . "\",";
                       $data_add .= "\"url_ogv\":\"" . $_video_url_ogv . "\",";
                       $data_add .= "\"url_webm\":\"" . $_video_url_webm . "\",";
                       $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;
                   ?>
Esempio n. 7
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">]');
}
Esempio n. 8
0
        /*-----------------------------------------------------------------------------------*/
        /* No video or slider attached, so get the featured image
        			/*-----------------------------------------------------------------------------------*/
        if ($post_meta[MAX_SHORTNAME . '_photo_item_type_value'] == 'none' && ($post_meta[MAX_SHORTNAME . '_photo_slider_select'] == 'none' || $post_meta[MAX_SHORTNAME . '_photo_slider_select'] == "slider-kwicks") || $show_compact == 'true') {
            if (function_exists('has_post_thumbnail') && has_post_thumbnail()) {
                // Get the thumbnail
                $imgID = get_post_thumbnail_id();
                $imgUrl = max_get_image_path($post->ID, 'full');
                $img_w = $page_tpl == 'template-blog-fullsize.php' ? MAX_FULL_WIDTH : MAX_CONTENT_WIDTH;
                // Check if images should be cropped
                $img_h = false;
                if (get_option_max('image_blog_original_ratio') != 'true') {
                    $img_h = $page_tpl == 'template-blog-fullsize.php' ? 354 : 250;
                }
                // get the imgUrl for showing the post image
                $imgUrl = max_get_custom_image_url(get_post_thumbnail_ID(), get_the_ID(), $img_w, $img_h, $post_meta[MAX_SHORTNAME . '_photo_cropping_direction_value']);
                ?>
							<div class="entry-image">
								<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                echo htmlspecialchars(get_the_excerpt());
                ?>
">
									<img src="<?php 
                echo $imgUrl;
                ?>
" width="<?php 
                echo $img_w;
                ?>
Esempio n. 9
0
            ?>
</h3>

						<div id="max-preloader">
							<div class="max-loader">
							</div>
						</div>

						<ul id="portfolioList" class="clearfix portfolio-list">

							<?php 
            // start the posts loop
            while ($gallery_posts->have_posts()) {
                $gallery_posts->the_post();
                // get the default image if we don't have to crop
                $_imgUrl = max_get_custom_image_url(get_post_thumbnail_id(get_the_ID()), null, 400, 300, get_cropping_direction(get_post_meta(get_the_ID(), MAX_SHORTNAME . '_photo_cropping_direction_value', true)));
                ?>
								<li data-id="id-<?php 
                echo get_the_ID();
                ?>
" class="item <?php 
                echo max_get_post_lightbox_class();
                if (get_option_max('image_show_fade') != "true") {
                    echo " no-hover";
                }
                ?>
">
									<div class="shadow">
										<?php 
                echo '<a href="' . get_permalink() . '" title="' . strip_tags(get_the_title()) . '"><img src="' . $_imgUrl . '" alt="' . strip_tags(get_the_title()) . '" /></a>';
                ?>
Esempio n. 10
0
    function widget($args, $instance)
    {
        global $imgDimensions;
        $cache = wp_cache_get('widget_my_custom_recent_posts', 'widget');
        if (!is_array($cache)) {
            $cache = array();
        }
        if (isset($cache[$args['widget_id']])) {
            echo $cache[$args['widget_id']];
            return;
        }
        ob_start();
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Photostream', MAX_SHORTNAME) : $instance['title'], $instance, $this->id_base);
        if (!($number = (int) $instance['number'])) {
            $number = 10;
        } else {
            if ($number < 1) {
                $number = 1;
            }
        }
        // get the posts from gallery category you want to exclude
        $excluded_post_ids = get_objects_in_term(array(), GALLERY_TAXONOMY);
        $r = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'post_type' => array('gallery'), 'post__not_in' => $excluded_post_ids));
        if ($r->have_posts()) {
            ?>
        <?php 
            echo $before_widget;
            ?>
        <?php 
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>
        <ul class="clearfix">
        <?php 
            while ($r->have_posts()) {
                $r->the_post();
                ?>

		<li>

			<?php 
                // get the post image
                $imgUrl = max_get_custom_image_url(get_post_thumbnail_ID(get_the_ID()), get_the_ID(), 200, 200, get_cropping_direction(get_post_meta(get_the_ID(), MAX_SHORTNAME . '_photo_cropping_direction_value', true)));
                // get the gallery item
                echo '<a href="' . get_permalink(get_the_ID()) . '" title="' . get_the_ID() . '"><img src="' . $imgUrl . '" width="50" height="50" alt="' . get_the_title() . '" class="fade-image"/></a>';
                ?>

		</li>

        <?php 
            }
            ?>
        </ul>

        <?php 
            echo $after_widget;
            ?>

		<?php 
            // Reset the global $the_post as this query will have stomped on it
            wp_reset_postdata();
        }
        $cache[$args['widget_id']] = ob_get_flush();
        wp_cache_set('widget_my_custom_recent_posts', $cache, 'widget');
    }