<?php /* Template Name: Front */ get_header(); ?> <?php $featuredimage = wp_get_attachment_url(get_post_thumbnail_ID($post->ID)); ?> <section class="hero-header" style="background-image: url('<?php echo $featuredimage; ?> ')"> <div class="hero-bg"> <div class="hero-inner"> <div class="hero-content"> <h1><?php echo the_field(header_title); ?> </h1> <p><?php echo the_field(header_description); ?> </p> <div class="signup_form"> <form> <input type="text" placeholder="First Name" />
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>
<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;
function cltv_channel_video($id) { //default poster is the post's featured image $poster = wp_get_attachment_image_src(get_post_thumbnail_ID($id), 'full'); $poster = $poster[0]; $title = get_the_title($id); $filename = false; $live = false; $attachment_id = false; $youtube_url = false; //if showing a specific archive if (get_post_type($id) == 'archive') { $youtube_url = get_post_meta($id, 'youtube_url', true); if ($youtube_url) { $filename = $youtube_url; } else { $attachment_id = get_post_meta($id, 'video_file', true); $filename = wp_get_attachment_url(get_post_meta($id, 'video_file', true)); } $channel = get_post_meta($id, 'channel', true); } else { $channel = $id; //if showing live player if (get_field('is_live', $id)) { $filename = get_field('stream_key', $id); $live = true; } else { //default archive is set $default_archive = get_post_meta($id, 'default_archive', true); if ($default_archive) { $archive = $default_archive; } else { $archive_q = new WP_Query(array('post_type' => 'archive', 'meta_key' => 'channel', 'meta_value' => $id, 'posts_per_page' => 1)); if ($archive_q->have_posts()) { $archive = $archive_q->posts[0]->ID; } wp_reset_postdata(); } //found an archive if (isset($archive) && $archive) { $poster = wp_get_attachment_image_src(get_post_thumbnail_ID($archive), 'full'); $poster = $poster[0]; //if youtube video url $youtube_url = get_post_meta($archive, 'youtube_url', true); if ($youtube_url) { $filename = $youtube_url; } else { $attachment_id = get_post_meta($archive, 'video_file', true); $filename = basename(get_attached_file(get_post_meta($archive, 'video_file', true))); } $title = get_the_title($archive); } } } if ($filename) { $http = false; if ($youtube_url) { $src = array('html5' => $youtube_url, 'flash' => false); } else { $src = cltv_format_video_src($filename, $live, $http, $attachment_id, $channel); } $commercial_id = get_post_meta($id, 'commercial', true); $commercial = false; if ($commercial_id) { $commercial = get_post($commercial_id); if ($commercial) { $commercial_youtube_url = get_post_meta($commercial_id, 'youtube_url', true); if ($commercial_youtube_url) { $commercial = $commercial_youtube_url; } else { $attachment_id = get_post_meta($commercial->ID, 'commercial_video_file', true); $commercial = basename(get_field('commercial_video_file', $commercial->ID)); $commercial = cltv_format_video_src($commercial, false, $http, $attachment_id, $channel); } } } return array('src' => $src, 'poster' => $poster, 'title' => $title, 'commercial' => $commercial); } else { return false; } }
} 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()); }
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; }
$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; ?>
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">]'); }
/*-----------------------------------------------------------------------------------*/ /* 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; ?>
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'); }