function custom_image_directory($path, $args) { if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail('post', 'twitter-image', $args['id'])) { // get the image for Twitter $imgid = MultiPostThumbnails::get_post_thumbnail_id('post', 'twitter-image', $args['id']); $path = wp_get_attachment_url($imgid); // Using amazon S3? Replace your S3 path with local path $path = str_replace('http://brewbound-images.s3.amazonaws.com/', 'c:\\inetpub\\wp-brewbound\\', $path); $path = str_replace('/', '\\', $path); } return $path; }
function get_extra_images() { global $post, $wp_query; $extra_images_no = get_option("extra_images_no"); $post_ID = $post->ID; if ($extra_images_no == "") { $extra_images_no = 4; } $postFormat = get_post_format($post->ID); $page_template = get_page_template(); $path = pathinfo($page_template); $page_template = $path['filename']; $post_extra_images = array(); //$post_captions = array(); $post_type = get_post_type($post->ID); for ($i = 1; $i <= $extra_images_no; $i++) { if (get_post_meta($post_ID, "background_image", true) != "extra-image-" . $i) { if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail($post_type, "extra-image-" . $i . "")) { $image_id = MultiPostThumbnails::get_post_thumbnail_id($post_type, "extra-image-" . $i . "", $post_ID); $image_feature_url = wp_get_attachment_image_src($image_id, "thumbnail"); //$post_extra_images[] = $image_feature_url[0]; $post_extra_images .= '<img src="' . $image_feature_url[0] . '" alt="' . get_post_field('post_excerpt', $image_id) . '" />'; print '<img src="' . $image_feature_url[0] . '" alt="' . get_post_field('post_excerpt', $image_id) . '" />'; //$image_thumb_url = wp_get_attachment_image_src( $image_id, "thumbnail" ); //$post_extra_thumb_images[] = $image_thumb_url[0]; //$post_captions[$i-1] = get_post_field('post_excerpt', $image_id); } } } }
/** * Output the metabox with the media modal chooser * * @global type $_wp_additional_image_sizes * @param type $post */ public function thumbnail_meta_box_modal($post) { global $_wp_additional_image_sizes; ?> <style> #select-mpt-<?php echo esc_js($this->prefix); ?> {overflow: hidden; padding: 4px 0;} #select-mpt-<?php echo esc_js($this->prefix); ?> .remove {display: none; margin-top: 10px; } #select-mpt-<?php echo esc_js($this->prefix); ?> .has-featured-image .remove { display: inline-block; } #select-mpt-<?php echo esc_js($this->prefix); ?> a { clear: both; float: left; } #select-mpt-<?php echo esc_js($this->prefix); ?> img { height: auto; margin-bottom: 10px; max-width: 100%; } </style> <script type="text/javascript"> jQuery( function($) { var $element = $('#select-mpt-<?php echo esc_js($this->prefix); ?> '), $thumbnailId = $element.find('input[name="<?php echo esc_js($this->prefix); ?> -thumbnail_id"]'), title = 'Choose a <?php echo esc_js($this->label); ?> ', update = 'Update <?php echo esc_js($this->label); ?> ', Attachment = wp.media.model.Attachment, frame, setMPTImage; setMPTImage = function( thumbnailId ) { var selection; $element.find('img').remove(); $element.toggleClass( 'has-featured-image', -1 != thumbnailId ); $thumbnailId.val( thumbnailId ); if ( frame ) { selection = frame.get('library').get('selection'); if ( -1 === thumbnailId ) selection.clear(); else selection.add( Attachment.get( thumbnailId ) ); } }; $element.on( 'click', '.choose, img', function( event ) { event.preventDefault(); if ( frame ) { frame.open(); return; } options = { title: title, library: { type: 'image' } }; thumbnailId = $thumbnailId.val(); if ( '' !== thumbnailId && -1 !== thumbnailId ) options.selection = [ Attachment.get( thumbnailId ) ]; frame = wp.media( options ); frame.toolbar.on( 'activate:select', function() { frame.toolbar.view().set({ select: { style: 'primary', text: update, click: function() { var selection = frame.state().get('selection'), model = selection.first(), sizes = model.get('sizes'), size; setMPTImage( model.id ); // @todo: might need a size hierarchy equivalent. if ( sizes ) size = sizes['<?php echo esc_js("{$this->post_type}-{$this->id}-thumbnail"); ?> '] || sizes['post-thumbnail'] || sizes.medium; // @todo: Need a better way of accessing full size // data besides just calling toJSON(). size = size || model.toJSON(); frame.close(); $( '<img />', { src: size.url, width: size.width }).prependTo( $element ); } } }); }); }); $element.on( 'click', '.remove', function( event ) { event.preventDefault(); setMPTImage( -1 ); }); }); </script> <?php $thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id($this->post_type, $this->id, $post->ID); $thumbnail_size = isset($_wp_additional_image_sizes["{$this->prefix}-thumbnail"]) ? "{$this->prefix}-thumbnail" : 'medium'; $thumbnail_html = wp_get_attachment_image($thumbnail_id, $thumbnail_size); $classes = empty($thumbnail_id) ? '' : 'has-featured-image'; ?> <div id="select-mpt-<?php echo esc_attr($this->prefix); ?> " class="<?php echo esc_attr($classes); ?> " data-post-id="<?php echo esc_attr($post->ID); ?> "> <?php echo $thumbnail_html; ?> <input type="hidden" name="<?php echo esc_js($this->prefix); ?> -thumbnail_id" value="<?php echo esc_attr($thumbnail_id); ?> " /> <a href="#" class="choose button-secondary">Choose a <?php echo esc_html($this->label); ?> </a> <a href="#" class="remove">Remove <?php echo esc_html($this->label); ?> </a> </div> <?php }
function memberlite_getBannerImageID($post = NULL) { global $memberlite_defaults; $memberlite_loop_images = get_theme_mod('memberlite_loop_images', $memberlite_defaults['memberlite_loop_images']); if (in_the_loop() && ($memberlite_loop_images == 'show_both' || $memberlite_loop_images == 'show_banner') || is_single() || is_home() || is_page() && !is_page_template('templates/landing.php')) { if (class_exists('MultiPostThumbnails')) { //The Banner Image meta box is available $thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id($post->post_type, 'memberlite_banner_image' . $post->post_type, $post->ID); } if (!empty($thumbnail_id)) { //Use Banner Image as banner return $thumbnail_id; } else { $memberlite_show_image_banner = get_post_meta($post->ID, 'memberlite_show_image_banner', true); if (!empty($memberlite_show_image_banner) || in_the_loop()) { //Use Featured Image as banner $thumbnail_id = get_post_thumbnail_id($post->ID); return $thumbnail_id; } else { return false; } } } else { return false; } }
<?php /** * The template for displaying all single posts and attachments * * @package WordPress * @subpackage Twenty_Sixteen * @since Twenty Sixteen 1.0 */ get_header(); the_post(); $slider = MultiPostThumbnails::get_post_thumbnail_id('pelicula', 'interior', $post->ID); $slider = wp_get_attachment_image_src($slider, 'full'); $anio = get_post_meta($post->ID, "wpcf-ano-de-estreno", true); $stars = get_post_meta($post->ID, "wpcf-calificacion", true); ?> <section class="w-clearfix content"> <div class="moviecontent"> <div class="w-clearfix c960"> <div class="w-clearfix peliculasrecientes"> <h1 class="titlesection"><?php the_title(); ?> </h1> <div class="pordagrande" style="background-image: url('<?php echo $slider[0]; ?> ')"></div> <div class="w-clearfix descripcionpeli"> <div class="w-clearfix des"> <h1 class="titlesection titleinfo">Resumen</h1>
*/ get_header(); ?> <?php $pages = unserialize(get_option('parallax_page_list', true)); $p_count = count($pages); if (is_array($pages) && !empty($pages)) { foreach ($pages as $ids) { $content_post = get_post($ids); $content = $content_post->post_content; $content = apply_filters('the_content', $content); $color = get_post_meta($ids, 'pbgcolor', true); $paraanimate = get_post_meta($ids, 'parallax_animate', true); $paraoverlay = get_post_meta($ids, 'parallax_overlay', true); $custom = MultiPostThumbnails::get_post_thumbnail_id('page', 'parallax-image', $ids); $custom = wp_get_attachment_image_src($custom, 'parallax-image'); $url = $custom[0]; $back_status = get_post_meta($ids, 'backgroud_status', true); $back = ''; if ($url != '') { $back = $url; } else { $back = ''; } $animate = ''; if ($paraanimate == 'yes') { $animate = 'animation: animatedBackground 80s linear infinite;-ms-animation: animatedBackground 80s linear infinite;-moz-animation: animatedBackground 80s linear infinite;-webkit-animation: animatedBackground 80s linear infinite;background-attachment: fixed;'; } $overlay = ''; if ($paraoverlay == 'yes') {
?> " /> <figcaption><?php echo $caption; ?> </figcaption> </figure> <?php } ?> <?php if (MultiPostThumbnails::has_post_thumbnail(get_post_type(), 'image3')) { ?> <?php $post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'image3', get_queried_object_id()); $post_thumbnail_post = get_post($post_thumbnail_id); $caption = trim(strip_tags($post_thumbnail_post->post_excerpt)); $caption = esc_html($caption); ?> <figure class="extra-image"> <img src="<?php echo $imgURL = MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'image3', NULL, 'large'); ?> " alt="<?php echo $caption; ?> " /> <figcaption><?php echo $caption; ?>
<?php require_once '../../../../wp-config.php'; global $wpdb; global $db; $id = $_REQUEST['id']; $fondo = MultiPostThumbnails::get_post_thumbnail_id('pelicula', 'descripcion', $id); $fondo = wp_get_attachment_image_src($fondo, 'descripcion'); $anio = get_post_meta($id, "wpcf-ano-de-estreno", true); $post = get_post($id); $excerpt = get_the_excerpt($id); $excerpt = substr($excerpt, 0, 220); $excerpt = substr($excerpt, 0, strripos($excerpt, " ")); ?> <div class="imagecontent" style="background-image: url('<?php echo $fondo[0]; ?> ')"></div> <div class="shadow"></div> <div class="w-clearfix textdescription"> <h1 class="titul tdescrip"><?php echo get_the_title($id); ?> </h1> <div class="extract"><?php echo $excerpt . '...'; ?> </div> <div class="year">Año de estreno: <span class="yea"><?php echo $anio;
function ep_thumbnail_gallery_slideshow($image_size, $id, $post_name, $terms, $isLink, $pLink) { // Add slideshow javascript global $add_slider; $add_slider = true; $maxthumbnum = 3; // Set the slideshow variable $slideshow = ''; // Get The Post Type $posttype = get_post_type($id); // Check whether the slide should link $permalink = get_permalink($id); $title = get_the_title($id); // get the item title //For custom taxonomy use this line below $terms = wp_get_object_terms($id, 'gallery_cat'); $term_names = array(); foreach ($terms as $term) { $term_names[] = $term->name; } if ($isLink == true) { $permalink = '<div class="galleryItem" data-sub-html=" <h4> ' . get_the_title($id) . '</h4><p>' . get_post_meta($id, "subtitle-text", true) . '</p>" data-src="' . $pLink . '"><a href="' . $pLink . '" title="' . $title . '" class="portfolioLink overlay thumbnail-' . $image_size . '">'; } else { $gallery_url = ''; $gallery_url = get_post_meta($id, '_thumbnail_id', false); $gallery_url = wp_get_attachment_image_src($gallery_url[0], $image_size, false); $permalink = '<div class="galleryItem" data-sub-html=" <h4> ' . get_the_title($id) . '</h4><p>' . get_post_meta($id, "subtitle-text", true) . '</p>" data-src="' . $gallery_url[0] . '"><a href="' . $gallery_url[0] . '" title="' . $title . '" class=" portfolioLink overlay thumbnail-' . $image_size . '">'; } $permalinkend = '</a></div>'; $counter = 2; //start counter at 2 $full = get_post_meta($id, '_thumbnail_id', false); // Get Image ID $image_size = 'ep_thumbnail-' . $image_size; // Get all slides ${"full" . $counter} = MultiPostThumbnails::get_post_thumbnail_id($posttype, $counter . '-slide', $id); // Get Image ID ${"alt" . $counter} = get_post_meta(${"full" . $counter}, '_wp_attachment_image_alt', true); // Alt text of image ${"full" . $counter} = wp_get_attachment_image_src(${"full" . $counter}, false); // URL of Second Slide Full Image ${"thumb" . $counter} = MultiPostThumbnails::get_post_thumbnail_id($posttype, $counter . '-slide', $id); ${"thumb" . $counter} = wp_get_attachment_image_src(${"thumb" . $counter}, $image_size, false); // URL of next Slide //number of entered thumbnails $maxthumbnumset = 1; // Show featured image $thumb = ''; if ($full) { $alt = get_post_meta($full, '_wp_attachment_image_alt', true); // Alt text of image $thumb = get_post_meta($id, '_thumbnail_id', false); $thumb = wp_get_attachment_image_src($thumb[0], $image_size, false); // URL of Featured first slide } $slideshow .= $permalink . '<div class="hoverContent">'; $slideshow .= '<div class="frame top">'; $slideshow .= '<div></div>'; $slideshow .= '</div>'; $slideshow .= '<div class="frame right">'; $slideshow .= '<div></div>'; $slideshow .= '</div>'; $slideshow .= '<div class="frame bottom">'; $slideshow .= '<div></div>'; $slideshow .= '</div>'; $slideshow .= '<div class="frame left">'; $slideshow .= '<div></div>'; $slideshow .= '</div>'; $slideshow .= '<div class="icon-wrap"><div class="icon-type"></div></div><div class="center-line"></div><div class="title-wrap"><div class="titleContainer"><div class="hover-title" >' . get_the_title($id) . '</div><div class="hover-subtitle">' . implode(', ', $term_names) . '</div></div></div>'; $slideshow .= '</div>'; $slideshow .= $permalinkend; $slideshow .= '<div class="like">' . getPostLikeLink($id) . '</div>'; $thumb1 = $thumb; // Loop through thumbnails and set them $tcounter = 1; while ($tcounter <= $maxthumbnum) { if (${'thumb' . $tcounter}) { //If there is just 1 thumb or it is ipad if ($maxthumbnumset == 1 || isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) { $slideshow .= '<div class="pSlide" style="background-image: url(' . ${'thumb' . $tcounter}[0] . ');"><a href="' . ${'thumb' . $tcounter}[0] . '" ></a></div>'; break; } else { $slideshow .= '<div class="pSlide" style="background-image: url(' . ${'thumb' . $tcounter}[0] . ');"><a href="' . ${'thumb' . $tcounter}[0] . '"></a></div>'; } } $tcounter++; } return $slideshow; }
if (has_post_thumbnail($section->ID)) { $hasImage = true; $thumbnail_id = get_post_thumbnail_id($section->ID); $image = wp_get_attachment_url($thumbnail_id); } //get other feature images if (class_exists('MultiPostThumbnails')) { $i = 1; $j = 1; $imagefe = array(); $imagefe[0] = $image; while ($i <= 9) { $image_name = 'feature-image-' . $i; // sets image name as feature-image-1, feature-image-2 etc. if (MultiPostThumbnails::has_post_thumbnail('page_section', $image_name, $section->ID)) { $image_id = MultiPostThumbnails::get_post_thumbnail_id('page_section', $image_name, $section->ID); $imagefe[$j] = wp_get_attachment_url($image_id); $j++; } $i++; } } $format = get_post_meta($section->ID, 'section_format', true); $format = esc_attr($format); $theme = get_post_meta($section->ID, 'section_theme', true); $theme = esc_attr($theme); //1=>dark 2=>intense 3=>medium 4=>light ?> <div class="pageSection theme<?php echo $theme; ?>
function bliccaThemes_gallery($id) { $gallery_style = get_post_meta(get_the_ID(), 'gallery_format_style', true); $gallery_class = $thumbsizer = ""; if ($gallery_style == "grid") { $gallery_class = "post-grid-thumbnails"; $thumbsizer = "bliccaThemes-grid"; } else { $gallery_class = "post-slider"; $thumbsizer = "post-thumbnails"; } if (class_exists('MultiPostThumbnails')) { ?> <div class="<?php echo esc_attr($gallery_class); ?> "> <ul class="slides"> <?php if (has_post_thumbnail()) { $post_thumbnail_id = get_post_thumbnail_id(get_the_ID()); $thumb_post = get_post($post_thumbnail_id); // ESC // $src_url = esc_url($thumb_post->guid); $caption = trim(strip_tags($thumb_post->post_excerpt)); if (!empty($caption)) { $caption = '<div class="bliccaThemes-caption">' . esc_attr($caption) . '</div>'; } else { $caption = ""; } echo '<li><a href="' . $src_url . '" class="prettyPhoto" data-rel="prettyPhoto">' . get_the_post_thumbnail($id, $thumbsizer) . '</a>' . $caption . '</li>'; } ?> <?php if (class_exists('MultiPostThumbnails')) { $image = MultiPostThumbnails::get_the_post_thumbnail(get_post_type(), 'secondary-image', NULL, $thumbsizer); } if (!empty($image)) { $post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'secondary-image', get_the_ID()); $thumb_post = get_post($post_thumbnail_id); $src_url = esc_url($thumb_post->guid); $caption = trim(strip_tags($thumb_post->post_excerpt)); if (!empty($caption)) { $caption = '<div class="bliccaThemes-caption">' . esc_attr($caption) . '</div>'; } else { $caption = ""; } echo '<li><a href="' . $src_url . '" class="prettyPhoto" data-rel="prettyPhoto">' . $image . '</a>' . $caption . '</li>'; } if (class_exists('MultiPostThumbnails')) { $image = MultiPostThumbnails::get_the_post_thumbnail(get_post_type(), 'third-image', NULL, $thumbsizer); } if (!empty($image)) { $post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'third-image', get_the_ID()); $thumb_post = get_post($post_thumbnail_id); $src_url = esc_url($thumb_post->guid); $caption = trim(strip_tags($thumb_post->post_excerpt)); if (!empty($caption)) { $caption = '<div class="bliccaThemes-caption">' . esc_attr($caption) . '</div>'; } else { $caption = ""; } echo '<li><a href="' . $src_url . '" class="prettyPhoto" data-rel="prettyPhoto">' . $image . '</a>' . $caption . '</li>'; } if (class_exists('MultiPostThumbnails')) { $image = MultiPostThumbnails::get_the_post_thumbnail(get_post_type(), 'fourth-image', NULL, $thumbsizer); } if (!empty($image)) { $post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'fourth-image', get_the_ID()); $thumb_post = get_post($post_thumbnail_id); $src_url = esc_url($thumb_post->guid); $caption = trim(strip_tags($thumb_post->post_excerpt)); if (!empty($caption)) { $caption = '<div class="bliccaThemes-caption">' . esc_attr($caption) . '</div>'; } else { $caption = ""; } echo '<li><a href="' . $src_url . '" class="prettyPhoto" data-rel="prettyPhoto">' . $image . '</a>' . $caption . '</li>'; } if (class_exists('MultiPostThumbnails')) { $image = MultiPostThumbnails::get_the_post_thumbnail(get_post_type(), 'fifth-image', NULL, $thumbsizer); } if (!empty($image)) { $post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'fifth-image', get_the_ID()); $thumb_post = get_post($post_thumbnail_id); $src_url = esc_url($thumb_post->guid); $caption = trim(strip_tags($thumb_post->post_excerpt)); if (!empty($caption)) { $caption = '<div class="bliccaThemes-caption">' . esc_attr($caption) . '</div>'; } else { $caption = ""; } echo '<li><a href="' . $src_url . '" class="prettyPhoto" data-rel="prettyPhoto">' . $image . '</a>' . $caption . '</li>'; } if (class_exists('MultiPostThumbnails')) { $image = MultiPostThumbnails::get_the_post_thumbnail(get_post_type(), 'last-image', NULL, $thumbsizer); } if (!empty($image)) { $post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'last-image', get_the_ID()); $thumb_post = get_post($post_thumbnail_id); $src_url = esc_url($thumb_post->guid); $caption = trim(strip_tags($thumb_post->post_excerpt)); if (!empty($caption)) { $caption = '<div class="bliccaThemes-caption">' . esc_attr($caption) . '</div>'; } else { $caption = ""; } echo '<li><a href="' . $src_url . '" class="prettyPhoto" data-rel="prettyPhoto">' . $image . '</a>' . $caption . '</li>'; } ?> </ul> </div><?php } }
function get_homepage_info($image_size, $id, $crop, $thumbnum) { global $thumb, $full, $alt, $caption, $image_title; $i = 2; while ($i < $thumbnum) { global ${"thumb" . $i}; global ${"caption" . $i}; global ${"full" . $i}; global ${"alt" . $i}; $i++; } $counter = 2; //start counter at 2 $args = array('post_type' => 'attachment', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => null, 'post_parent' => $id); $thumbnail_image = get_posts($args); if ($thumbnail_image) { $caption = $thumbnail_image[0]->post_excerpt; } $full = get_post_meta($id, '_thumbnail_id', false); // Get Image ID $alt = get_post_meta($full, '_wp_attachment_image_alt', true); // Alt text of image $full = wp_get_attachment_image_src($full[0], 'blog', false); // URL of Featured Full Image if ($crop) { if ($crop == 'No Crop') { $thumb = get_post_meta($id, '_thumbnail_id', false); $thumb = wp_get_attachment_image_src($thumb[0], false); // URL of Featured first slide } else { $thumb = get_post_meta($id, '_thumbnail_id', false); $thumb = wp_get_attachment_image_src($thumb[0], $image_size, false); // URL of Featured first slide } } else { $thumb = get_post_meta($id, '_thumbnail_id', false); $thumb = wp_get_attachment_image_src($thumb[0], $image_size, false); // URL of Featured first slide } while ($counter < $thumbnum) { if ($counter == 2) { $countername = 'second'; } else { if ($counter == 3) { $countername = 'third'; } else { if ($counter == 4) { $countername = 'fourth'; } else { if ($counter == 5) { $countername = 'fifth'; } else { if ($counter == 6) { $countername = 'sixth'; } else { $countername = $counter; } } } } } ${"full" . $counter} = MultiPostThumbnails::get_post_thumbnail_id('post', $countername . '-slide', $id); // Get Image ID // The thumbnail caption: ${"caption" . $counter} = get_post(${"full" . $counter})->post_excerpt; ${"alt" . $counter} = get_post_meta(${"full" . $counter}, '_wp_attachment_image_alt', true); // Alt text of image ${"full" . $counter} = wp_get_attachment_image_src(${"full" . $counter}, false); // URL of Second Slide Full Image if ($crop) { if ($crop == 'No Crop') { ${"thumb" . $counter} = MultiPostThumbnails::get_post_thumbnail_id('post', $countername . '-slide', $id); ${"thumb" . $counter} = wp_get_attachment_image_src(${"thumb" . $counter}, false); // URL of next Slide } else { ${"thumb" . $counter} = MultiPostThumbnails::get_post_thumbnail_id('post', $countername . '-slide', $id); ${"thumb" . $counter} = wp_get_attachment_image_src(${"thumb" . $counter}, $image_size, false); // URL of next Slide } } else { ${"thumb" . $counter} = MultiPostThumbnails::get_post_thumbnail_id('post', $countername . '-slide', $id); ${"thumb" . $counter} = wp_get_attachment_image_src(${"thumb" . $counter}, $image_size, false); // URL of next Slide } $counter++; } }
/** * */ function marketify_get_attached_media_args($args, $type, $post) { global $post; if ('image' != $type) { return $args; } if ('download' != $post->post_type) { return $args; } if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::get_the_post_thumbnail('download', 'grid-image')) { $args['exclude'] = MultiPostThumbnails::get_post_thumbnail_id('download', 'grid-image', $post->ID); } return $args; }
function team_list($atts) { global $meta_box; $q = new WP_Query(array( 'post_type' => 'team', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, // = all of 'em )); echo '<div id="team-grid">'; echo '<div class="row">'; foreach ($q->posts as $item) { $team_title = get_post_meta( $item->ID, 'team_title', true ); $photo = wp_get_attachment_image_src( get_post_thumbnail_id( $item->ID ), 'single-post-thumbnail' ); $thumb = wp_get_attachment_image_src( MultiPostThumbnails::get_post_thumbnail_id('team', 'secondary-image', $item->ID), 'single-post-thumbnail' ); list($width, $height) = getimagesize($_SERVER[DOCUMENT_ROOT].$thumb[0]); //echo grid element if ($width == 410) { echo '<div class="span4">'; } else { echo '<div class="span2">'; } echo '<figure>'; echo '<a class="no-ajaxy" data-toggle="modal" href="#' . $item->post_name . '" >'; echo '<img src="'.$thumb[0].'" alt="' .$item->post_title. 's">'; echo '<figcaption>'; echo $item->post_title; echo '<br>'; echo '<i>'.$team_title.'</sup></i>'; echo '</figcaption>'; echo '<span class="view-bio">View Bio <i class="icon-chevron-right"></i></span>'; echo '<span class="team-overlay"></span>'; echo '</a>'; echo '</figure>'; echo '</div>'; //echo modal echo '<div class="modal fade" id="' . $item->post_name . '">'; echo '<div class="modal-body">'; echo '<div class="row">'; echo '<div class="span4">'; echo '<img src="'.$photo[0].'" alt="' .$item->post_title. 's">'; echo '</div>'; echo '<div class="span8">'; echo '<a class="close no-ajaxy" data-dismiss="modal">X</a>'; echo '<h1>'.$item->post_title.', <small><i>'.$team_title.'</i></small></h1>'; echo '<div class="scroll-pane">'; echo apply_filters( 'the_content' , $item->post_content ); echo '</div>'; echo '</div>'; echo '</div>'; echo '</div>'; echo '</div>'; } echo '</div>'; echo '</div>'; };
function get_portfolio_grid_image($item) { global $portfolio, $post, $msd_portfolio_url; $portfolio->the_meta($item->ID); $youtube = $portfolio->get_the_value('youtube'); if ($youtube != '') { if (class_exists('MultiPostThumbnails') && ($post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id('msd_portfolio', 'grid-image', $item->ID))) { $featured_image = wp_get_attachment_image_src($post_thumbnail_id, 'portfolio', false, $attr); $featured_image = $featured_image[0]; } else { preg_match('/^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|\\&v=)([^#\\&\\?]*).*/i', $youtube, $matches); $videoid = $matches[2]; $featured_image = 'http://img.youtube.com/vi/' . $videoid . '/0.jpg'; } } else { if (class_exists('MultiPostThumbnails') && ($post_thumbnail_id = MultiPostThumbnails::get_post_thumbnail_id('msd_portfolio', 'grid-image', $item->ID))) { $featured_image = wp_get_attachment_image_src($post_thumbnail_id, 'portfolio', false, $attr); $featured_image = $featured_image[0]; } else { $featured_image = featured_image($item->ID, 'portfolio'); $featured_image = $featured_image[0]; } } return $featured_image; }
?> <header class="entry-header"> <div class="entry-thumbnail tx-slider" data-delay="8000"> <?php $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large'); echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" alt="" class="tx-colorbox">'; the_post_thumbnail('imax-single-thumb'); echo '</a>'; if (class_exists('MultiPostThumbnails')) { $large_image_url1 = wp_get_attachment_image_src(MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'feature-image-2', $post->ID), 'large'); if ($large_image_url1) { echo '<a href="' . $large_image_url1[0] . '" title="' . the_title_attribute('echo=0') . '" class="tx-colorbox">'; MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'feature-image-2', NULL, 'imax-single-thumb'); echo '</a>'; } $large_image_url2 = wp_get_attachment_image_src(MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'feature-image-3', $post->ID), 'large'); if ($large_image_url2) { echo '<a href="' . $large_image_url2[0] . '" title="' . the_title_attribute('echo=0') . '" class="tx-colorbox">'; MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'feature-image-3', NULL, 'imax-single-thumb'); echo '</a>'; } } ?> </div> </header><!-- .entry-header --> <?php } ?> <div class="folio-meta">
function ag_post_slideshow($image_size, $id, $thumbnum, $arrows_outside, $slidelink = 'false') { // Add one to the thumbnail number for the loop $thumbnum++; // Set the slideshow variable $slideshow = ''; // Get The Post Type $posttype = get_post_type($id); // Check whether the slide should link if ($slidelink == 'true') { $permalink = get_permalink($id); $title = get_the_title($id); $permalink = '<a href="' . $permalink . '" title="' . $title . '">'; $permalinkend = '</a>'; } else { $permalink = ''; $permalinkend = ''; } $counter = 2; //start counter at 2 $full = get_post_meta($id, '_thumbnail_id', false); // Get Image ID /* If there's a featured image ================================================== */ if ($full) { $caption = get_post($full[0])->post_excerpt; $alt = get_post_meta($full, '_wp_attachment_image_alt', true); // Alt text of image $full = wp_get_attachment_image_src($full[0], 'full', false); // URL of Featured Full Image $thumb = get_post_meta($id, '_thumbnail_id', false); $thumb = wp_get_attachment_image_src($thumb[0], $image_size, false); // URL of Featured first slide // Get all slides while ($counter < $thumbnum) { ${"full" . $counter} = MultiPostThumbnails::get_post_thumbnail_id($posttype, $counter . '-slide', $id); // Get Image ID // The thumbnail caption: ${"caption" . $counter} = get_post(${"full" . $counter})->post_excerpt; ${"alt" . $counter} = get_post_meta(${"full" . $counter}, '_wp_attachment_image_alt', true); // Alt text of image ${"full" . $counter} = wp_get_attachment_image_src(${"full" . $counter}, false); // URL of Second Slide Full Image ${"thumb" . $counter} = MultiPostThumbnails::get_post_thumbnail_id($posttype, $counter . '-slide', $id); ${"thumb" . $counter} = wp_get_attachment_image_src(${"thumb" . $counter}, $image_size, false); // URL of next Slide $counter++; } // If there's a thumbnail set $slideshow .= '<div class="featured-image '; $slideshow .= isset($thumb2[0]) && $thumb2[0] != '' && $arrows_outside == true ? ' outsidearrows' : ''; $slideshow .= '">'; // If there's a slide 2 $slideshow .= isset($thumb2[0]) && $thumb2[0] != '' ? '<ul class="bxslider"><li>' : ''; // If there's a slide 2 and outside arrows are set to true $slideshow .= $permalink . '<img src="' . $thumb[0] . '" alt="'; // If there's an image alt info, set it $slideshow .= $alt ? str_replace('"', "", $alt) : get_the_title(); $slideshow .= '"'; // If there's a caption, add it. $slideshow .= $caption && $caption != '' ? ' title="' . strip_tags(apply_filters('the_content', $caption)) . '"' : ''; $slideshow .= ' class="scale-with-grid"/>' . $permalinkend; $slideshow .= isset($thumb2[0]) && $thumb2[0] != '' ? '</li>' : ''; // Loop through thumbnails and set them if (isset($thumb2[0]) && $thumb2[0] != '') { $tcounter = 2; while ($tcounter < $thumbnum) { if (${'thumb' . $tcounter}) { $slideshow .= '<li>' . $permalink . '<img src="' . ${'thumb' . $tcounter}[0] . '" alt="'; $slideshow .= ${'alt' . $tcounter} ? str_replace('"', "", ${'alt' . $tcounter}) : get_the_title(); $slideshow .= '" '; if (${'caption' . $tcounter} && ${'caption' . $tcounter} != '') { $slideshow .= ' title="' . strip_tags(apply_filters('the_content', ${'caption' . $tcounter})) . '"'; } $slideshow .= ' class="scale-with-grid" data-thumb="' . ${'thumb' . $tcounter}[0] . '"/>' . $permalinkend . '</li>'; } $tcounter++; } } // Add caption if there's no slideshow if (!(isset($thumb2[0]) && $thumb2[0] != '') && $caption) { $slideshow .= '<div class="bx-caption"><span>' . strip_tags(apply_filters('the_content', $caption)) . '</span></div>'; } $slideshow .= isset($thumb2[0]) && $thumb2[0] != '' ? '</ul>' : ''; // Close slideshow divs $slideshow .= '</div>'; } // End if $full return $slideshow; }