function widget($args, $instance) { $this->dt_hs_group++; $instance = wp_parse_args((array) $instance, self::$default_instance); extract($args); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); $args = array('no_found_rows' => 1, 'post_type' => 'dt_gallery', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array(array('taxonomy' => 'dt_gallery_category', 'field' => 'id', 'terms' => $instance['cats']))); switch ($instance['select']) { case 'only': $args['tax_query'][0]['operator'] = 'IN'; break; case 'except': $args['tax_query'][0]['operator'] = 'NOT IN'; break; default: unset($args['tax_query']); } add_filter('posts_clauses', 'dt_core_join_left_filter'); $g_query = new Wp_Query($args); remove_filter('posts_clauses', 'dt_core_join_left_filter'); $g_arr = array(); if (count($g_query->posts)) { foreach ($g_query->posts as $album) { if (post_password_required($album->ID)) { continue; } $g_arr[] = $album->ID; } } dt_storage('where_filter_param', implode(', ', $g_arr)); $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'inherit', 'orderby' => $instance['orderby'], 'order' => $instance['order']); add_filter('posts_where', 'dt_core_parents_where_filter'); $p_query = new Wp_Query($args); remove_filter('posts_where', 'dt_core_parents_where_filter'); $hs_slideshow_group = 'dt_widget_latphotos_' . intval($this->dt_hs_group); echo $before_widget; // start echo $before_title . $title . $after_title; echo '<div class="flickr" data-hs_group="' . $hs_slideshow_group . '">'; if ($p_query->have_posts()) { foreach ($p_query->posts as $photo) { if (post_password_required($photo->post_parent)) { continue; } $caption = $photo->post_excerpt; dt_get_thumb_img(array('img_meta' => wp_get_attachment_image_src($photo->ID, 'full'), 'class' => 'alignleft-f', 'title' => esc_attr($caption), 'alt' => get_post_meta($photo->ID, '_wp_attachment_image_alt', true), 'custom' => ' onclick="return hs.expand(this, { slideshowGroup: \'' . $hs_slideshow_group . '\' } )"', 'thumb_opts' => array('w' => 69, 'h' => 69))); /* if ( $caption && 0 ) echo '<div class="highslide-caption">'.$caption.'</div>'; */ } } echo '</div><!-- /.flickr -->'; echo $after_widget; }
public static function get_media_item($item_data, $align = 'horizontal') { if (!is_object($item_data)) { return ''; } $title = ''; $caption = ''; $link = ''; $title_template = '<h4>%s</h4>'; if (!empty($item_data->link)) { $link_url = $item_data->link; $link = '<a class="swiper-link" href="' . $link_url . '">' . __('Details', 'the7mk2') . '</a>'; $title_template = '<h4><a href="' . $link_url . '">%s</a></h4>'; } if (!empty($item_data->title)) { $title = sprintf($title_template, wp_kses($item_data->title, array())); } if (!empty($item_data->description)) { $caption = wpautop(wp_kses_post($item_data->description)); } $image = dt_get_thumb_img(array('echo' => false, 'img_meta' => array($item_data->full, $item_data->width, $item_data->height), 'img_id' => $item_data->ID, 'alt' => $item_data->alt, 'wrap' => '<img %IMG_CLASS% %SRC% %SIZE% %ALT% />', 'prop' => false)); $info = $title . $caption . $link; if ($info) { $info = sprintf('<span class="link show-content"></span> <div class="swiper-caption"> %s <span class="close-link"></span> </div>', $info); } $html = sprintf('<div class="swiper-slide"> %s %s </div>', $image, $info); return $html; }
function widget($args, $instance) { extract($args); $instance = wp_parse_args((array) $instance, self::$widget_defaults); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_portfolio', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_portfolio_category', 'field' => 'term_id', 'terms' => $instance['cats']))); switch ($instance['select']) { case 'only': $args['tax_query'][0]['operator'] = 'IN'; break; case 'except': $args['tax_query'][0]['operator'] = 'NOT IN'; break; default: unset($args['tax_query']); } $p_query = new WP_Query($args); // for usage as shortcode if (!isset($img_size)) { $img_size = array($instance['max_width'], $instance['max_width']); } if (!isset($img_size_origin)) { $img_size_origin = $img_size; } else { $p = $img_size[1] / $img_size[0]; $img_size_origin[1] = round($img_size_origin[0] * $p); } echo $before_widget; // title if ($title) { echo $before_title . $title . $after_title; } if ($p_query->have_posts()) { update_post_thumbnail_cache($p_query); echo '<div class="instagram-photos" data-image-max-width="' . absint($instance['max_width']) . '">'; while ($p_query->have_posts()) { $p_query->the_post(); $thumb_id = get_post_thumbnail_id(get_the_ID()); if (!has_post_thumbnail(get_the_ID())) { $args = array('posts_per_page' => 1, 'no_found_rows' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'post_status' => 'inherit'); $images = new WP_Query($args); if ($images->have_posts()) { $thumb_id = $images->posts[0]->ID; } } $thumb_meta = wp_get_attachment_image_src($thumb_id, 'full'); dt_get_thumb_img(array('img_meta' => $thumb_meta ? $thumb_meta : null, 'img_id' => $thumb_id, 'use_noimage' => true, 'class' => 'post-rollover', 'title' => get_the_title(), 'href' => get_permalink(), 'options' => array('w' => $img_size_origin[0], 'h' => $img_size_origin[1]), 'wrap' => "\n" . '<a %HREF% %TITLE% %CLASS% %CUSTOM%><img %IMG_CLASS% %SRC% ' . image_hwstring($img_size[0], $img_size[1]) . ' %ALT% /></a>' . "\n")); } // while have posts wp_reset_postdata(); echo '</div>'; } // if have posts echo $after_widget; }
/** * Porthole slider data. * */ function presscore_render_porthole_slider_data() { global $post; $config = Presscore_Config::get_instance(); $slider_id = $config->get('slideshow_sliders'); $slideshows = presscore_query()->get_posts(array('post_type' => 'dt_slideshow', 'post__in' => $slider_id, 'has_password' => false)); if (!$slideshows || !$slideshows->have_posts()) { return; } $slides = array(); foreach ($slideshows->posts as $slideshow) { $media_items = get_post_meta($slideshow->ID, '_dt_slider_media_items', true); if (empty($media_items)) { continue; } $slides = array_merge($slides, $media_items); } $slides = array_unique($slides); $media_query = presscore_query()->get_attachments(array('posts_per_page' => -1, 'orderby' => 'post__in', 'post__in' => $slides)); // prepare data if ($media_query->have_posts()) { echo '<ul id="main-slideshow-content" class="royalSlider rsHomePorthole">'; while ($media_query->have_posts()) { $media_query->the_post(); $video_url = get_post_meta($post->ID, 'dt-video-url', true); $img_link = get_post_meta($post->ID, 'dt-img-link', true); $thumb_meta = wp_get_attachment_image_src($post->ID, 'thumbnail'); $hide_title = presscore_imagee_title_is_hidden($post->ID); $img_custom = 'data-rsTmb="' . $thumb_meta[0] . '"'; if ($video_url) { $img_custom .= ' data-rsVideo="' . esc_url($video_url) . '"'; } $img_args = array('img_meta' => wp_get_attachment_image_src($post->ID, 'full'), 'img_id' => $post->ID, 'img_class' => 'rsImg', 'custom' => $img_custom, 'echo' => false, 'wrap' => '<img %IMG_CLASS% %SRC% %CUSTOM% %ALT% %SIZE% />'); $image = dt_get_thumb_img($img_args); $caption = ''; if (!$config->get('slideshow_hide_captions')) { if (!$hide_title && ($title = get_the_title())) { $caption .= '<div class="rsTitle">' . $title . '</div>'; } if ($content = get_the_content()) { $caption .= '<div class="rsDesc">' . $content . '</div>'; } if ($caption) { $caption = sprintf('<figure class="rsCapt rsABlock">%s</figure>', $caption); } if ($img_link) { $caption = sprintf('<a class="rsCLink" href="%s"><span class="assistive-text">%s</span></a>', esc_url($img_link), __('details', 'the7mk2')) . $caption; } } printf('<li>%s</li>', $image . $caption); } wp_reset_postdata(); echo '</ul>'; } }
function widget($args, $instance) { static $number = 0; $number++; extract($args); $instance = wp_parse_args((array) $instance, self::$widget_defaults); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); // get albums from selected categories $args = array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'dt_gallery', 'post_status' => 'publish', 'tax_query' => array(array('taxonomy' => 'dt_gallery_category', 'field' => 'id', 'terms' => $instance['cats']))); switch ($instance['select']) { case 'only': $args['tax_query'][0]['operator'] = 'IN'; break; case 'except': $args['tax_query'][0]['operator'] = 'NOT IN'; break; default: unset($args['tax_query']); } $p_query = new WP_Query($args); $attachments_ids_array = array(); // get attachments id if ($p_query->have_posts()) { foreach ($p_query->posts as $album) { // get saved data, hope it's array $attachments = get_post_meta($album->ID, '_dt_album_media_items', true); if (!$attachments) { continue; } $attachments_ids_array = array_merge($attachments_ids_array, (array) $attachments); } } $attachments_ids_array = array_unique($attachments_ids_array); $a_query = false; if ($attachments_ids_array) { if ('menu_order' == $instance['orderby']) { $instance['orderby'] = 'post__in'; if ('DESC' == $instance['order']) { krsort($attachments_ids_array); $attachments_ids_array = array_values($attachments_ids_array); } } $a_query = new WP_Query(array('posts_per_page' => $instance['show'], 'no_found_rows' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_status' => 'inherit', 'post__in' => $attachments_ids_array, 'order' => $instance['order'], 'orderby' => $instance['orderby'])); } echo $before_widget . "\n"; // title if ($title) { echo $before_title . $title . $after_title . "\n"; } if ($a_query && $a_query->have_posts()) { $share_buttons = presscore_get_share_buttons_for_prettyphoto('photo'); echo '<div class="instagram-photos dt-gallery-container"' . $share_buttons . '>' . "\n"; while ($a_query->have_posts()) { $a_query->the_post(); $post_id = get_the_ID(); $thumb_meta = wp_get_attachment_image_src($post_id, 'full'); $img = dt_get_thumb_img(array('img_meta' => $thumb_meta, 'img_id' => $post_id, 'class' => 'rollover rollover-small dt-mfp-item mfp-image', 'options' => array('w' => 90, 'h' => 90), 'wrap' => "\n" . '<a %HREF% %CLASS% %CUSTOM% title="%RAW_ALT%" data-dt-img-description="%RAW_TITLE%" data-dt-location="' . esc_attr(get_permalink($post_id)) . '"><img %IMG_CLASS% %SRC% %SIZE% %ALT% /></a>' . "\n")); } wp_reset_postdata(); echo '</div>' . "\n"; } // if have posts echo $after_widget . "\n"; }
/** * This method render's team item. * * @param integer $post_id If empty - uses current post id. * * @return string Item html. */ public static function render_teammate($post_id = null) { $post_id = $post_id ? $post_id : get_the_ID(); if (!$post_id) { return ''; } $html = ''; $content = get_the_content($post_id); if ($content) { $content = '<div class="team-content">' . wpautop($content) . '</div>'; } // get featured image $image = ''; if (has_post_thumbnail($post_id)) { $thumb_id = get_post_thumbnail_id($post_id); $teammate_thumb_args = array('img_meta' => wp_get_attachment_image_src($thumb_id, 'full'), 'img_id' => $thumb_id, 'options' => false, 'echo' => false, 'wrap' => '<img %IMG_CLASS% %SRC% %SIZE% %IMG_TITLE% %ALT% />'); /** * Applied filters: * presscore_set_image_width_based_on_column_width() in template-tags.php */ $teammate_thumb_args = apply_filters('teammate_thumbnail_args', $teammate_thumb_args); $image = dt_get_thumb_img($teammate_thumb_args); } // get links $links = array(); if (function_exists('presscore_get_team_links_array')) { foreach (presscore_get_team_links_array() as $id => $data) { $link = get_post_meta($post_id, '_dt_teammate_options_' . $id, true); if ($link) { $links[] = presscore_get_social_icon($id, $link, $data['desc']); } } } if (empty($links)) { $links = ''; } else { $links = '<div class="soc-ico">' . implode('', $links) . '</div>'; } // get position $position = get_post_meta($post_id, '_dt_teammate_options_position', true); if ($position) { $position = '<p>' . $position . '</p>'; } else { $position = ''; } // get title $title = get_the_title($post_id); if ($title) { $title = '<div class="team-author-name">' . $title . '</div>'; } else { $title = ''; } $author_block = $title . $position; if ($author_block) { $author_block = '<div class="team-author">' . $author_block . '</div>'; } // get it all togeather $html = sprintf('<div class="team-container">' . "\n\t" . '%1$s<div class="team-desc">%2$s</div>' . "\n\t" . '</div>' . "\n", $image, $author_block . $content . $links); return $html; }
?> <?php // if there are images - put it to the "hidden container" if ($images->have_posts() && !post_password_required()) { $hs_group = 'dt_gallery_' . $post->ID; ?> <div class="hidden-container" data-hs_group="<?php echo $hs_group; ?> "> <?php foreach ($images->posts as $image) { dt_get_thumb_img(array('class' => 'highslide', 'alt' => get_post_meta($image->ID, '_wp_attachment_image_alt', true), 'img_meta' => wp_get_attachment_image_src($image->ID, 'full'), 'title' => esc_attr(strip_tags($image->post_excerpt)), 'thumb_opts' => array('w' => 90, 'h' => 90)), '<a %HREF% %CLASS% %TITLE% %CUSTOM%><img %ALT% %SRC% %SIZE% /></a>'); ?> <div class="highslide-caption"><?php echo $image->post_excerpt; // show like mini button if (dt_is_page_soc_buttons_enabled('gallery')) { dt_get_like_window(array('img' => urlencode(current(wp_get_attachment_image_src($image->ID, 'thumbnail'))), 'full' => urlencode(current(wp_get_attachment_image_src($image->ID, 'full'))), 'src' => urlencode(get_permalink($image->ID)))); } ?> </div> <?php } ?> </div> <?php
while ($images->have_posts()) { $images->the_post(); $link = get_post_meta($post->ID, '_dt_slider_link', true); $hide_desc = get_post_meta($post->ID, '_dt_slider_hdesc', true); $link_neww = get_post_meta($post->ID, '_dt_slider_newwin', true); $tmp_arr = array(); if (!empty($post->post_excerpt) && !$hide_desc) { $tmp_arr['caption'] = get_the_excerpt(); } if (!empty($post->post_title) && !$hide_desc) { $tmp_arr['title'] = $post->post_title; } $img = wp_get_attachment_image_src($post->ID, 'full'); if ($img) { if ('fullscreen_slider' != $slider_options['slider']) { $tmp_arr['src'] = str_replace(array('src="', '"'), '', dt_get_thumb_img(array('img_meta' => $img, 'thumb_opts' => $slide_hw[$slider_options['slider']]), '%SRC%', false)); $tmp_arr['size_str'] = image_hwstring($slide_hw[$slider_options['slider']]['w'], $slide_hw[$slider_options['slider']]['h']); } else { $tmp_arr['src'] = $img[0]; $tmp_arr['size_str'] = image_hwstring($img[1], $img[2]); } $tmp_arr['alt'] = get_post_meta($post->ID, '_wp_attachment_image_alt', true); } if ($link) { $tmp_arr['link'] = esc_attr($link); } $tmp_arr['in_neww'] = intval($link_neww); $slides_arr[] = $tmp_arr; } wp_reset_postdata(); $autoslide = intval($slider_options['auto_period']);
case 'aside': case 'link': case 'quote': case 'status': // post content presscore_get_template_part('theme', 'blog/blog-post-content-part', $post_format); break; case 'image': default: $img_class = 'alignnone'; $img_options = false; // thumbnail if (has_post_thumbnail() && !$hide_thumbnail) { $thumb_id = get_post_thumbnail_id(); $thumb_meta = wp_get_attachment_image_src($thumb_id, 'full'); dt_get_thumb_img(array('class' => $img_class . ' rollover rollover-zoom dt-single-mfp-popup dt-mfp-item mfp-image', 'img_meta' => $thumb_meta, 'img_id' => $thumb_id, 'options' => $img_options, 'wrap' => '<a %HREF% %CLASS% %CUSTOM% title="%RAW_ALT%" data-dt-img-description="%RAW_TITLE%"><img %IMG_CLASS% %SRC% %SIZE% %IMG_TITLE% %ALT% /></a>')); } // post content the_content(); } ?> <?php wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'the7mk2'), 'after' => '</div>')); ?> <?php $post_tags = ''; $config = presscore_get_config(); if ($config->get('post.meta.fields.tags')) { $post_tags = presscore_get_post_tags_html();
/** * Description here. * * Some sort of images list with some description and post title and date ... eah * * @return array Array of items or empty array. */ function presscore_get_posts_small_list($attachments_data, $options = array()) { if (empty($attachments_data)) { return array(); } global $post; $default_options = array('links_rel' => '', 'show_images' => true, 'image_dimensions' => array('w' => 60, 'h' => 60)); $options = wp_parse_args($options, $default_options); $image_args = array('img_class' => '', 'class' => 'alignleft post-rollover', 'custom' => $options['links_rel'], 'options' => array('w' => $options['image_dimensions']['w'], 'h' => $options['image_dimensions']['h'], 'z' => true), 'echo' => false); $articles = array(); $class = ''; $post_was_changed = false; $post_backup = $post; foreach ($attachments_data as $data) { $new_post = null; if (isset($data['parent_id'])) { $post_was_changed = true; $new_post = get_post($data['parent_id']); if ($new_post) { $post = $new_post; setup_postdata($post); } } $permalink = esc_url($data['permalink']); $attachment_args = array('href' => $permalink, 'img_meta' => array($data['full'], $data['width'], $data['height']), 'img_id' => empty($data['ID']) ? 0 : $data['ID'], 'echo' => false, 'wrap' => '<a %CLASS% %HREF% %CUSTOM%><img %IMG_CLASS% %SRC% %SIZE% %ALT% /></a>'); // show something if there is no title if (empty($data['title'])) { $data['title'] = _x('No title', 'blog small list', 'the7mk2'); } if (!empty($data['parent_id'])) { $class = 'post-' . presscore_get_post_format_class(get_post_format($data['parent_id'])); if (empty($data['ID'])) { $attachment_args['wrap'] = '<a %HREF% %CLASS% %TITLE% style="width:' . $options['image_dimensions']['w'] . 'px; height: ' . $options['image_dimensions']['h'] . 'px;"></a>'; $attachment_args['class'] = $image_args['class'] . ' no-avatar'; $attachment_args['img_meta'] = array('', 0, 0); $attachment_args['options'] = false; } } $article = sprintf('<article class="%s"><div class="wf-td">%s</div><div class="post-content">%s%s</div></article>', $class, $options['show_images'] ? dt_get_thumb_img(array_merge($image_args, $attachment_args)) : '', '<a href="' . $permalink . '">' . esc_html($data['title']) . '</a><br />', '<time class="text-secondary" datetime="' . get_the_date('c') . '">' . get_the_date(get_option('date_format')) . '</time>'); $articles[] = $article; } if ($post_was_changed) { $post = $post_backup; setup_postdata($post); } return $articles; }
$align = 'alignleft'; $custom = 'style="width: 270px;"'; $thumb_options = array('w' => 270, 'z' => 1); } $thumb_args = array('img_meta' => $thumb_meta, 'img_id' => $thumb_id, 'class' => $align . ' rollover dt-single-mfp-popup dt-mfp-item mfp-image', 'options' => $thumb_options, 'custom' => $custom, 'echo' => false, 'wrap' => '<a %HREF% %CLASS% %CUSTOM% %IMG_TITLE% data-dt-img-description="%RAW_TITLE%"><img %IMG_CLASS% %SRC% %IMG_TITLE% %ALT% %SIZE% /></a>'); if ('list' != $layout) { if ('wide' == $preview_mode && !$config->get('all_the_same_width')) { $target_image_width = $config->get('target_width') * 3; $thumb_args['options'] = array('w' => round($target_image_width), 'z' => 0, 'hd_convert' => false); } else { $target_image_width = $config->get('target_width') * 1.5; $thumb_args['options'] = array('w' => round($target_image_width), 'z' => 0); } } $thumb_args = apply_filters('dt_post_thumbnail_args', $thumb_args); $media = dt_get_thumb_img($thumb_args); if ('list' != $layout) { $media = '<p>' . $media . '</p>'; } echo $media; } ?> </div> <div class="blog-content wf-td"> <h2 class="entry-title"> <a href="<?php the_permalink(); ?> " title="<?php echo the_title_attribute('echo=0'); ?>
protected function get_slide_thumbnail(&$slide) { $args = array('img_meta' => $slide->image_src, 'img_id' => $slide->id, 'alt' => $slide->image_alt, 'options' => array('w' => $this->settings['thumbnails_width'] ? $this->settings['thumbnails_width'] : null, 'h' => $this->settings['thumbnails_height'], 'z' => 1), 'wrap' => '<img %IMG_CLASS% %SRC% %SIZE% %ALT% />', 'echo' => false); return dt_get_thumb_img($args); }
function widget($args, $instance) { extract($args); $instance = wp_parse_args((array) $instance, $this->dt_defaults); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); $autoslide = $instance['autoslide']; $autoslide_on = $autoslide ? 1 : 0; global $wpdb; $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_team', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_team_category', 'field' => 'id', 'terms' => $instance['cats']))); switch ($instance['select']) { case 'only': $args['tax_query'][0]['operator'] = 'IN'; break; case 'except': $args['tax_query'][0]['operator'] = 'NOT IN'; break; default: unset($args['tax_query']); } add_filter('posts_clauses', 'dt_core_join_left_filter'); $p_query = new WP_Query($args); remove_filter('posts_clauses', 'dt_core_join_left_filter'); // caching! if ($p_query->have_posts()) { $images = array(); foreach ($p_query->posts as $p) { if (has_post_thumbnail($p->ID)) { $images[] = get_post_thumbnail_id($p->ID); } } if ($images) { $i_query = new WP_Query(array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'attachment', 'post_status' => 'inherit', 'post__in' => $images)); } } echo $before_widget; // start echo $before_title . $title . $after_title; ?> <div class="reviews-t coda-team"> <?php if ($p_query->have_posts()) { // remove jetpack share buttons filter remove_filter('the_content', 'sharing_display', 19); $data = array(); foreach ($p_query->posts as $teammate) { $teammate_data = get_post_meta($teammate->ID, '_dt_team_info', true); $position = isset($teammate_data['position']) ? $teammate_data['position'] : ''; $age = isset($teammate_data['age']) ? '<br />' . $teammate_data['age'] : ''; $thumb_id = get_post_thumbnail_id($teammate->ID); if (has_post_thumbnail($teammate->ID)) { $thumb_meta = wp_get_attachment_image_src($thumb_id, 'full'); } else { $thumb_meta = null; } // get alt $img_alt = get_post_meta($thumb_id, '_wp_attachment_image_alt', true); if (!$img_alt) { $img_alt = get_the_title($teammate->ID); } ob_start(); ?> <div class="team-wrap"> <?php dt_get_thumb_img(array('img_meta' => $thumb_meta, 'alt' => $img_alt, 'use_noimage' => true, 'img_class' => 'alignleft', 'thumb_opts' => array('w' => 80, 'h' => 100)), '<img %SRC% %IMG_CLASS% %SIZE% %ALT% />'); ?> <span class="head"><?php echo $teammate->post_title; ?> </span> <?php if (isset($position) || isset($age)) { ?> <p class="mid-gray"><span><?php echo $position . $age; ?> </span></p> <?php } ?> <div class="team-description"><?php echo apply_filters('the_content', strip_shortcodes($teammate->post_content)); ?> </div> </div> <?php $str = ob_get_clean(); $data[] = array($str); } $auto_data = sprintf('data-autoslide="%s" data-autoslide_on="%s"', $autoslide, $autoslide_on); dt_get_coda_slider(array('wrap' => '<div class="list-carousel coda bx"><ul class="slider1" ' . $auto_data . '>%SLIDER%</ul></div>', 'item_wrap' => '<li>%1$s</li>', 'data' => $data)); } ?> </div> <?php echo $after_widget; }
function widget($args, $instance) { extract($args); $instance = wp_parse_args((array) $instance, $this->dt_defaults); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); $autoslide = $instance['autoslide']; $autoslide_on = $autoslide ? 1 : 0; global $wpdb, $post; $args = array('no_found_rows' => 1, 'posts_per_page' => 1, 'post_type' => 'dt_slider', 'post_status' => 'publish', 'post__in' => array($instance['cats'])); $p_query = new WP_Query($args); echo $before_widget; // start echo $before_title . $title . $after_title; ?> <div class="navig-small"> <a class="SliderNamePrev" href="javascript:void(0);"></a> <a class="SliderNameNext" href="javascript:void(0);"></a> </div> <div class="slider_container_1"> <?php if ($p_query->have_posts()) { $slides_arr = array(); foreach ($p_query->posts as $album) { $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => $album->ID, 'post_status' => 'inherit', 'orderby' => 'menu_order', 'order' => 'ASC'); $images = new WP_Query($args); if ($images->have_posts()) { while ($images->have_posts()) { $images->the_post(); $link = get_post_meta($post->ID, '_dt_slider_link', true); $hide_desc = !!get_post_meta($post->ID, '_dt_slider_hdesc', true); $link_neww = get_post_meta($post->ID, '_dt_slider_newwin', true); $tmp_arr = array(); if (!empty($post->post_excerpt) && !$hide_desc) { $tmp_arr['caption'] = wp_trim_words(get_the_excerpt(), 15, ''); } if (!empty($link)) { $tmp_arr['link'] = $link; } if (!empty($link_neww)) { $tmp_arr['link_neww'] = true; } if (!empty($post->post_title) && !$hide_desc) { $tmp_arr['title'] = $post->post_title; } $img = wp_get_attachment_image_src($post->ID, 'full'); if ($img) { $tmp_arr['src'] = str_replace(array('src="', '"'), '', dt_get_thumb_img(array('img_meta' => $img, 'thumb_opts' => array('w' => 210, 'h' => 210)), '%SRC%', false)); $tmp_arr['size_str'] = image_hwstring(210, 210); $tmp_arr['alt'] = esc_attr(get_post_meta($post->ID, '_wp_attachment_image_alt', true)); } $slides_arr[] = $tmp_arr; } } else { ?> <div style="color: red; margin: 0 auto; padding: 20px; text-shadow: none; "><?php _e('There are no images in the slider.', LANGUAGE_ZONE); ?> </div> <?php } } $images = $caption = ''; $i = 1; foreach ($slides_arr as $slide) { $slide_link = ''; if (!empty($slide['link'])) { $slide_link = '<div class="link"><a href="' . esc_url($slide['link']) . '"' . (!empty($slide['link_neww']) ? 'target="_blank"' : '') . '></a></div>'; } $caption .= '<div class="nivo-html-caption caption-' . $i . '">'; if (!empty($slide['caption'])) { $caption .= '<p>' . $slide['caption'] . '</p>'; } $caption .= $slide_link . '</div>'; $images .= '<img src="' . $slide['src'] . '" alt="' . $slide['alt'] . '" title=".caption-' . $i . '" ' . $slide['size_str'] . ' />'; $i++; } ?> <div class="widget_slider" data-autoslide="<?php echo $autoslide; ?> " data-autoslide_on="<?php echo $autoslide_on; ?> "><?php echo $images; ?> </div><?php echo $caption; ?> </div> <?php } wp_reset_postdata(); echo $after_widget; }
$post_classes = array('dt-testimon'); if (1 == $posts_count) { $post_classes[] = 'first'; } ?> <div class="<?php echo implode(' ', $post_classes); ?> "> <div class="panel-wrapper"><?php the_content(); ?> </div> <div class="panel-author"><?php if (has_post_thumbnail($post_id)) { dt_get_thumb_img(array('img_meta' => wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full'), 'thumb_opts' => array('w' => 30, 'h' => 30)), '<img class="alignleft" %SRC% %SIZE% %ALT%/>'); } if ($author = get_the_title()) { ?> <p class="author-name"><?php echo $author; ?> </p><?php } if (!empty($opts['position'])) { ?> <span class="author-position"><?php echo $opts['position']; ?> </span><?php }
function widget($args, $instance) { extract($args); $instance = wp_parse_args((array) $instance, $this->dt_defaults); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); $autoslide = $instance['autoslide']; $autoslide_on = $autoslide ? 1 : 0; $h = 130; if ($instance['thumb_height']) { $h = $instance['thumb_height']; } $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_catalog', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_catalog_category', 'field' => 'id', 'terms' => $instance['cats']))); switch ($instance['select']) { case 'only': $args['tax_query'][0]['operator'] = 'IN'; break; case 'except': $args['tax_query'][0]['operator'] = 'NOT IN'; break; default: unset($args['tax_query']); } add_filter('posts_clauses', 'dt_core_join_left_filter'); $p_query = new WP_Query($args); remove_filter('posts_clauses', 'dt_core_join_left_filter'); // caching! if ($p_query->have_posts()) { $images = array(); foreach ($p_query->posts as $p) { if (has_post_thumbnail($p->ID)) { $images[] = get_post_thumbnail_id($p->ID); } } if ($images) { $i_query = new WP_Query(array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'attachment', 'post_status' => 'inherit', 'orderby' => 'menu_order', 'post__in' => $images)); } } echo $before_widget; // start echo $before_title . $title . $after_title; ?> <div class="list-carousel recent bx"> <ul class="sliderBx" data-autoslide="<?php echo $autoslide; ?> " data-autoslide_on="<?php echo $autoslide_on; ?> "> <?php if ($p_query->have_posts()) { $class = ' first'; while ($p_query->have_posts()) { $p_query->the_post(); $thumb_meta = null; $thumb_id = get_post_thumbnail_id(get_the_ID()); if (has_post_thumbnail(get_the_ID())) { $thumb_meta = wp_get_attachment_image_src($thumb_id, 'full'); } if (!$thumb_meta) { $images = new WP_Query(array('posts_per_page' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'post_parent' => get_the_ID(), 'post_status' => 'inherit')); if ($images->have_posts()) { $thumb_meta = wp_get_attachment_image_src($images->posts[0]->ID, 'full'); } } ?> <li> <div class="textwidget<?php echo $class; ?> "> <?php $main_img_alt = get_post_meta(get_the_ID(), '_wp_attachment_image_alt', true); $img = dt_get_thumb_img(array('class' => 'photo', 'img_meta' => $thumb_meta, 'use_noimage' => true, 'title' => get_the_title(), 'href' => get_permalink(), 'thumb_opts' => array('w' => 210, 'h' => $h)), "\n" . '<div class="textwidget-photo">' . "\n" . '<a %HREF% %CLASS% %TITLE% %CUSTOM%>' . "\n" . '<img alt="' . esc_attr($main_img_alt) . '" %SRC% %SIZE% />' . "\n" . '</a>' . "\n" . '</div>' . "\n"); if ($instance['desc']) { ?> <div class="widget-info"> <h3><a href="<?php echo get_permalink(); ?> " class="head"><?php echo get_the_title(); ?> </a></h3> <p><?php echo strip_tags(get_the_excerpt()); ?> </p> </div> <?php } ?> </div><!-- .textwidget --> </li> <?php } wp_reset_postdata(); } ?> </ul><!-- .carouFredSel_1 --> </div><!-- .list-carousel --> <?php echo $after_widget; }
> <?php do_action('presscore_before_post_content'); ?> <?php $img_meta = wp_get_attachment_image_src($post->ID, 'full'); $img_args = array('img_meta' => $img_meta, 'img_id' => $post->ID, 'custom' => 'data-dt-img-description="' . esc_attr(get_the_excerpt()) . '"', 'class' => 'alignnone rollover rollover-zoom dt-single-mfp-popup dt-mfp-item mfp-image', 'title' => get_the_title(), 'wrap' => '<a %HREF% %CLASS% %CUSTOM% %TITLE%><img %IMG_CLASS% %SRC% %ALT% %SIZE% /></a>'); if (isset($img_meta[1]) && $img_meta[1] < 890) { $img_args['wrap'] = "\n" . '<img %IMG_CLASS% %SRC% %SIZE% %ALT%/>' . "\n"; $img_args['class'] = ''; $img_args['img_class'] = 'alignleft'; $img_args['custom'] = ''; } dt_get_thumb_img($img_args); the_content(); presscore_display_share_buttons_for_post('photo'); ?> </article> <?php do_action('presscore_after_post_content'); ?> <?php } ?> <?php
function widget($args, $instance) { extract($args); /* Our variables from the widget settings. */ $defaults = array('title' => '', 'order' => 'ASC', 'show' => 6, 'orderby' => 'modified', 'select' => 'all', 'thumb' => true, 'cats' => array()); $instance = wp_parse_args((array) $instance, $defaults); $title = apply_filters('widget_title', $instance['title']); $args = array('no_found_rows' => 1, 'posts_per_page' => intval($instance['show']), 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'no_found_rows' => true, 'ignore_sticky_posts' => true, 'tax_query' => array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => $instance['cats']))); switch ($instance['select']) { case 'only': $args['tax_query'][0]['operator'] = 'IN'; break; case 'except': $args['tax_query'][0]['operator'] = 'NOT IN'; break; default: unset($args['tax_query']); } add_filter('posts_clauses', 'dt_core_join_left_filter'); $query = new WP_Query($args); remove_filter('posts_clauses', 'dt_core_join_left_filter'); // caching! if ($query->have_posts()) { // get posts thumbnails id's $images = array(); foreach ($query->posts as $p) { if (has_post_thumbnail($p->ID)) { $images[] = get_post_thumbnail_id($p->ID); } } // get all images in once if ($images) { $i_query = new WP_Query(array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'attachment', 'post_status' => 'inherit', 'post__in' => $images)); } } if ($query->have_posts()) { echo $before_widget; // start if ($title) { echo $before_title . $title . $after_title; } $count = 0; while ($query->have_posts()) { $query->the_post(); $count++; $img = ''; if ($instance['thumb'] && has_post_thumbnail()) { $img_id = get_post_thumbnail_id(); // get alt $img_alt = get_post_meta($img_id, '_wp_attachment_image_alt', true); if (!$img_alt) { $img_alt = get_the_title(); } $img = dt_get_thumb_img(array('alt' => $img_alt, 'img_meta' => wp_get_attachment_image_src($img_id, 'full'), 'href' => get_permalink(), 'thumb_opts' => array('w' => 50, 'h' => 50)), '<a %HREF% class="alignleft img-post view" ><img %SRC% %SIZE% %ALT% /></a>', false); } ?> <div class="post<?php echo 1 == $count ? ' ' : ''; ?> "> <div class="post-bg"> <?php echo $img; ?> <div class="post-inner"> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> <div class="goto-post"> <span class="ico-link date"><?php echo get_the_date(get_option('date_format'), get_the_ID()); ?> </span> <?php dt_get_comments_link('<span class="ico-link comments">%COUNT%</span>', array('no_coments' => '')); ?> </div> </div> </div> </div> <?php } echo $after_widget; } wp_reset_postdata(); }
<?php /** * Blog post media template for image post format in masonry layout * * @package vogue * @since 1.0.0 */ // File Security Check if (!defined('ABSPATH')) { exit; } $thumb_id = get_post_thumbnail_id(); $thumb_args = array('img_meta' => wp_get_attachment_image_src($thumb_id, 'full'), 'img_id' => $thumb_id, 'options' => presscore_set_image_dimesions(), 'class' => 'alignnone rollover dt-single-mfp-popup dt-mfp-item mfp-image', 'wrap' => '<p><a %HREF% %CLASS% %CUSTOM% title="%RAW_ALT%" data-dt-img-description="%RAW_TITLE%"><img %IMG_CLASS% %SRC% %IMG_TITLE% %ALT% %SIZE% /></a></p>'); $thumb_args = apply_filters('dt_post_thumbnail_args', $thumb_args); // output media dt_get_thumb_img($thumb_args);
/** * Portfolio media slider. * * Based on royal slider. Properly works only in the loop. * * @return string HTML. */ function presscore_get_project_media_slider($class = array()) { global $post; // slideshow dimensions $slider_proportions = get_post_meta($post->ID, '_dt_project_options_slider_proportions', true); $slider_proportions = wp_parse_args($slider_proportions, array('width' => '', 'height' => '')); $width = $slider_proportions['width']; $height = $slider_proportions['height']; // get slideshow $media_items = get_post_meta($post->ID, '_dt_project_media_items', true); $slideshow = ''; if (!$media_items) { $media_items = array(); } // if we have post thumbnail and it's not hidden if (has_post_thumbnail()) { if (is_single()) { if (!get_post_meta($post->ID, '_dt_project_options_hide_thumbnail', true)) { array_unshift($media_items, get_post_thumbnail_id()); } } else { array_unshift($media_items, get_post_thumbnail_id()); } } $attachments_data = presscore_get_attachment_post_data($media_items); // TODO: make it clean and simple if (count($attachments_data) > 1) { $slideshow = presscore_get_royal_slider($attachments_data, array('width' => $width, 'height' => $height, 'class' => $class, 'style' => ' style="width: 100%"')); } elseif (!empty($attachments_data)) { $image = current($attachments_data); $thumb_id = $image['ID']; $thumb_meta = array($image['full'], $image['width'], $image['height']); $video_url = esc_url(get_post_meta($thumb_id, 'dt-video-url', true)); $thumb_args = array('img_meta' => $thumb_meta, 'img_id' => $thumb_id, 'img_class' => 'preload-me', 'class' => 'alignnone rollover', 'href' => get_permalink($post->ID), 'wrap' => '<a %CLASS% %HREF% %TITLE% %CUSTOM%><img %IMG_CLASS% %SRC% %ALT% %SIZE% /></a>', 'echo' => false); if ($video_url) { $thumb_args['class'] = 'alignnone rollover-video'; } $thumb_args = apply_filters('dt_portfolio_thumbnail_args', $thumb_args); $slideshow = dt_get_thumb_img($thumb_args); } return $slideshow; }
function widget($args, $instance) { // outputs the content of the widget extract($args); $defaults = array('title' => '', 'thumb' => true, 'show' => 5); $instance = wp_parse_args($instance, $defaults); $title = apply_filters('widget_title', $instance['title']); $posts = new WP_Query(array('no_found_rows' => 1, 'post_status' => 'publish', 'posts_per_page' => $instance['show'], 'ignore_sticky_posts' => true, 'no_found_rows' => true)); // caching! if ($posts->have_posts()) { // get posts thumbnails id's $images = array(); foreach ($posts->posts as $p) { if (has_post_thumbnail($p->ID)) { $images[] = get_post_thumbnail_id($p->ID); } } // get all images in once if ($images) { $i_query = new WP_Query(array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'attachment', 'post_status' => 'inherit', 'post__in' => $images)); } } echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $last = $posts->found_posts; if ($posts->have_posts()) { $i = 1; foreach ($posts->posts as $post_item) { $class = ''; if ($i == 1) { $class = ' first'; } elseif ($i == $last) { $class = ' last'; } $title = get_the_title($post_item->ID); if (!$title) { $title = __('No title', LANGUAGE_ZONE); } $img = ''; if ($instance['thumb'] && has_post_thumbnail($post_item->ID)) { $img_id = get_post_thumbnail_id($post_item->ID); $img_meta = wp_get_attachment_image_src($img_id, 'full'); // get alt $img_alt = get_post_meta($img_id, '_wp_attachment_image_alt', true); if (!$img_alt) { $img_alt = get_the_title($post_item->ID); } $img = dt_get_thumb_img(array('alt' => $img_alt, 'img_meta' => $img_meta, 'href' => get_permalink($post_item->ID), 'thumb_opts' => array('w' => 50, 'h' => 50)), '<a %HREF% class="alignleft img-post view" ><img %SRC% %SIZE% %ALT% /></a>', false); } ?> <div class="post<?php echo $class; ?> "> <div class="post-bg"> <?php echo $img; ?> <div class="post-inner"> <a href="<?php echo get_permalink($post_item->ID); ?> "><?php echo $title; ?> </a> <div class="goto-post"> <span class="ico-link date"><?php echo get_the_date(get_option('date_format'), $post_item->ID); ?> </span> <?php dt_get_comments_link('<span class="ico-link comments">%COUNT%</span>', array('no_coments' => ''), $post_item->ID); ?> </div> </div> </div> </div> <?php $i++; } } echo $after_widget; }
/** * Get image based on devicePixelRatio coocie and theme options. * * @param $logo array Regular logo. * @param $r_logo array Retina logo. * @param $default array Default logo. * @param $custom string Custom img attributes. * * @return string. */ function dt_get_retina_sensible_image ( $logo, $r_logo, $default, $custom = '', $class = '' ) { if ( empty( $default ) ) { return ''; } if ( $logo && !$r_logo ) { $r_logo = $logo; } elseif ( $r_logo && !$logo ) { $logo = $r_logo; } elseif ( !$r_logo && !$logo ) { $logo = $r_logo = $default; } if ( dt_retina_on() ) { $img_meta = dt_is_hd_device() ? $r_logo : $logo; } else { $img_meta = $logo; } if ( ! isset( $img_meta['size'] ) && isset( $img_meta[1], $img_meta[2] ) ) { $img_meta['size'] = image_hwstring( $img_meta[1], $img_meta[2] ); } $output = dt_get_thumb_img( array( 'wrap' => '<img %IMG_CLASS% %SRC% %SIZE% %CUSTOM% />', 'img_class' => $class, 'img_meta' => $img_meta, 'custom' => $custom, 'echo' => false, // TODO: add alt if it's possible 'alt' => '', ) ); return $output; }
/** * Hoovered gallery. * * @param array $attachments_data Attachments data array. * @param array $options Gallery options. * * @return string HTML. */ function presscore_get_images_gallery_hoovered($attachments_data, $options = array()) { if (empty($attachments_data)) { return ''; } // clear attachments_data foreach ($attachments_data as $index => $data) { if (empty($data['full'])) { unset($attachments_data[$index]); } } unset($data); if (empty($attachments_data)) { return ''; } static $gallery_counter = 0; $gallery_counter++; $id_mark_prefix = 'pp-gallery-hoovered-media-content-' . $gallery_counter . '-'; $default_options = array('echo' => false, 'class' => array(), 'links_rel' => '', 'style' => '', 'share_buttons' => false, 'exclude_cover' => false, 'title_img_options' => array(), 'title_image_args' => array(), 'attachments_count' => null, 'show_preview_on_hover' => true, 'video_icon' => true); $options = wp_parse_args($options, $default_options); $class = implode(' ', (array) $options['class']); $small_images = array_slice($attachments_data, 1); $big_image = current($attachments_data); if (!is_array($options['attachments_count']) || count($options['attachments_count']) < 2) { $attachments_count = presscore_get_attachments_data_count($options['exclude_cover'] ? $small_images : $attachments_data); } else { $attachments_count = $options['attachments_count']; } list($images_count, $videos_count) = $attachments_count; $count_text = array(); if ($images_count) { $count_text[] = sprintf(_n('1 image', '%s images', $images_count, 'the7mk2'), $images_count); } if ($videos_count) { $count_text[] = sprintf(__('%s video', 'the7mk2'), $videos_count); } $count_text = implode(', ', $count_text); $image_args = array('img_class' => 'preload-me', 'class' => $class, 'custom' => implode(' ', array($options['links_rel'], $options['style'])), 'echo' => false); $image_hover = ''; $mini_count = 3; $html = ''; $share_buttons = ''; if ($options['share_buttons']) { $share_buttons = presscore_get_share_buttons_for_prettyphoto('photo'); } // medium images if (!empty($small_images)) { $html .= '<div class="dt-gallery-container mfp-hide"' . $share_buttons . '>'; foreach ($attachments_data as $key => $data) { if ($options['exclude_cover'] && 0 == $key) { continue; } $small_image_args = array('img_meta' => $data['thumbnail'], 'img_id' => empty($data['ID']) ? $data['ID'] : 0, 'alt' => $data['title'], 'title' => $data['description'], 'href' => esc_url($data['full']), 'custom' => '', 'class' => 'mfp-image'); if ($options['share_buttons']) { $small_image_args['custom'] = 'data-dt-location="' . esc_attr($data['permalink']) . '" '; } $mini_image_args = array('img_meta' => $data['thumbnail'], 'img_id' => empty($data['ID']) ? $data['ID'] : 0, 'alt' => $data['title'], 'title' => $data['description'], 'wrap' => '<img %IMG_CLASS% %SRC% %ALT% %IMG_TITLE% width="90" />'); if ($mini_count && !(!$options['exclude_cover'] && 0 == $key) && $options['show_preview_on_hover']) { $image_hover = '<span class="r-thumbn-' . $mini_count . '">' . dt_get_thumb_img(array_merge($image_args, $mini_image_args)) . '<i>' . $count_text . '</i></span>' . $image_hover; $mini_count--; } if (!empty($data['video_url'])) { $small_image_args['href'] = $data['video_url']; $small_image_args['class'] = 'mfp-iframe'; } $html .= sprintf('<a href="%s" title="%s" class="%s" data-dt-img-description="%s" %s></a>', esc_url($small_image_args['href']), esc_attr($small_image_args['alt']), esc_attr($small_image_args['class'] . ' dt-mfp-item'), esc_attr($small_image_args['title']), $small_image_args['custom']); } $html .= '</div>'; } unset($image); if ($image_hover && $options['show_preview_on_hover']) { $image_hover = '<span class="rollover-thumbnails">' . $image_hover . '</span>'; } // big image $big_image_args = array('img_meta' => array($big_image['full'], $big_image['width'], $big_image['height']), 'img_id' => empty($big_image['ID']) ? $big_image['ID'] : 0, 'wrap' => '<a %HREF% %CLASS% %CUSTOM% %TITLE%><img %SRC% %IMG_CLASS% %ALT% %IMG_TITLE% %SIZE% />' . $image_hover . '</a>', 'alt' => $big_image['alt'], 'title' => $big_image['title'], 'class' => $class, 'options' => $options['title_img_options']); if (empty($small_images)) { $big_image_args['custom'] = ' data-dt-img-description="' . esc_attr($big_image['description']) . '"' . $share_buttons; if ($options['share_buttons']) { $big_image_args['custom'] = ' data-dt-location="' . esc_attr($big_image['permalink']) . '"' . $big_image_args['custom']; } $big_image_args['class'] .= ' dt-single-mfp-popup dt-mfp-item mfp-image'; } else { $big_image_args['custom'] = $image_args['custom']; $big_image_args['class'] .= ' dt-gallery-mfp-popup'; } $big_image_args = apply_filters('presscore_get_images_gallery_hoovered-title_img_args', $big_image_args, $image_args, $options, $big_image); if ($options['video_icon'] && !empty($big_image['video_url']) && !$options['exclude_cover']) { $big_image_args['href'] = $big_image['video_url']; $blank_image = presscore_get_blank_image(); $video_link_classes = 'video-icon'; if (empty($small_images)) { $video_link_classes .= ' mfp-iframe dt-single-mfp-popup dt-mfp-item'; } else { $video_link_classes .= ' dt-gallery-mfp-popup'; } $video_link_custom = $big_image_args['custom']; $big_image_args['class'] = str_replace(array('rollover', 'mfp-image'), array('rollover-video', ''), $class); $big_image_args['custom'] = $options['style']; $big_image_args['wrap'] = '<div %CLASS% %CUSTOM%><img %IMG_CLASS% %SRC% %ALT% %IMG_TITLE% %SIZE% /><a %HREF% %TITLE% class="' . $video_link_classes . '"' . $video_link_custom . '></a></div>'; } $image = dt_get_thumb_img(array_merge($image_args, $big_image_args, $options['title_image_args'])); $html = $image . $html; return $html; }
"> <h2><?php echo $title; ?> </h2> <div class="entry-meta"> <?php dt_get_date_link(array('class' => 'ico-link date', 'wrap' => '<span class="%CLASS%">%DATE%</span>')); dt_get_author_link(array('class' => 'ico-link author', 'wrap' => '<span %CLASS%><a %HREF%>%AUTHOR%</a></span>')); dt_get_taxonomy_link('category', '<span class="ico-link categories">%CAT_LIST%</span>'); dt_get_comments_link($comments, array('no_coments' => '')); ?> </div> <?php if (!post_password_required($post->ID)) { if ('dt_team' !== $post->post_type && 'dt_benefits' !== $post->post_type) { dt_get_thumb_img(array('class' => 'alignleft text', 'href' => get_permalink(), 'thumb_opts' => array('w' => 210, 'h' => 210))); } dt_the_content(); dt_details_link(); dt_edit_link(); } else { echo get_the_password_form(); } ?> </div>
function widget($args, $instance) { global $post; static $hs_group = 0; $hs_group++; extract($args); $instance = wp_parse_args((array) $instance, $this->dt_defaults); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); $autoslide = $instance['autoslide']; $autoslide_on = $autoslide ? 1 : 0; $h = 130; if ($instance['thumb_height']) { $h = $instance['thumb_height']; } $args = array('no_found_rows' => 1, 'posts_per_page' => $instance['show'], 'post_type' => 'dt_gallery', 'post_status' => 'publish', 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'tax_query' => array(array('taxonomy' => 'dt_gallery_category', 'field' => 'id', 'terms' => $instance['cats']))); switch ($instance['select']) { case 'only': $args['tax_query'][0]['operator'] = 'IN'; break; case 'except': $args['tax_query'][0]['operator'] = 'NOT IN'; break; default: unset($args['tax_query']); } add_filter('posts_where', 'dt_exclude_post_protected_filter'); add_filter('posts_clauses', 'dt_core_join_left_filter'); $p_query = new WP_Query($args); remove_filter('posts_clauses', 'dt_core_join_left_filter'); remove_filter('posts_where', 'dt_exclude_post_protected_filter'); // caching! if ($p_query->have_posts()) { $gals_ids = array(); foreach ($p_query->posts as $gal) { $gals_ids[] = $gal->ID; } $args = array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'attachment', 'post_status' => 'inherit', 'orderby' => 'menu_order'); dt_storage('where_filter_param', implode(',', $gals_ids)); add_filter('posts_where', 'dt_core_parents_where_filter'); $i_query = new WP_Query($args); remove_filter('posts_where', 'dt_core_parents_where_filter'); $cached_images = array(); if ($i_query->have_posts()) { foreach ($i_query->posts as $cached_image) { if (!isset($cached_images[$cached_image->post_parent])) { $cached_images[$cached_image->post_parent] = array(); } $cached_images[$cached_image->post_parent][$cached_image->ID] = $cached_image; } } } echo $before_widget; // start echo $before_title . $title . $after_title; ?> <div class="list-carousel recent bx"> <ul class="sliderBx" data-autoslide="<?php echo $autoslide; ?> " data-autoslide_on="<?php echo $autoslide_on; ?> "> <?php if ($p_query->have_posts()) { $class = ' first'; $hs_class = ' highslide'; $group = 1; while ($p_query->have_posts()) { $p_query->the_post(); $thumb_id = get_post_thumbnail_id(); $args = array('no_found_rows' => 1, 'posts_per_page' => -1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => get_the_ID(), 'post_status' => 'inherit'); $images = new WP_Query($args); if (has_post_thumbnail(get_the_ID())) { $thumb_meta = wp_get_attachment_image_src($thumb_id, 'full'); } elseif ($images->have_posts()) { $thumb_meta = wp_get_attachment_image_src($images->posts[0]->ID, 'full'); } else { $thumb_meta = null; } ?> <li> <div class="textwidget<?php echo $class; ?> "> <?php $main_img_alt = get_post_meta(get_the_ID(), '_wp_attachment_image_alt', true); dt_get_thumb_img(array('class' => 'photo' . ($instance['desc'] ? '' : $hs_class), 'img_meta' => $thumb_meta, 'title' => get_the_title(), 'custom' => '', 'use_noimage' => true, 'thumb_opts' => array('w' => 210, 'h' => $h)), '<div class="textwidget-photo"><a %HREF% %CLASS% %TITLE% %CUSTOM%><img alt="' . esc_attr($main_img_alt) . '" %SRC% %SIZE% /></a></div>'); $class = ''; if ($images->have_posts()) { ?> <div class="hidden-container" data-hs_group="dt_widget_gallery_<?php echo $hs_group . '_' . $group; ?> "> <?php foreach ($images->posts as $image) { $alt = get_post_meta($image->ID, '_wp_attachment_image_alt', true); dt_get_thumb_img(array('class' => 'highslide', 'title' => strip_tags($image->post_excerpt), 'img_meta' => wp_get_attachment_image_src($image->ID, 'full'), 'thumb_opts' => array('w' => 90, 'h' => 90)), '<a %HREF% %CLASS% %CUSTOM% %TITLE% ><img alt="' . esc_attr($alt) . '" %SRC% %SIZE%/></a>'); } ?> </div> <?php } ?> <?php if ($instance['desc']) { ?> <div class="widget-info"> <h3><a href="<?php echo get_permalink(); ?> " class="head"><?php echo get_the_title(); ?> </a></h3> <p><?php echo strip_tags(get_the_excerpt()); ?> </p> </div> <?php } ?> </div> </li> <?php $group++; } wp_reset_postdata(); } ?> </ul> </div> <?php echo $after_widget; }
/** * Get post attachment html. * * Check if there is video_url and react respectively. * * @param array $attachment_data * @param array $options * * @return string */ function presscore_get_post_attachment_html($attachment_data, $options = array()) { if (empty($attachment_data['ID'])) { return ''; } $default_options = array('link_rel' => '', 'class' => array(), 'wrap' => ''); $options = wp_parse_args($options, $default_options); $class = $options['class']; $image_media_content = ''; if (!$options['wrap']) { $options['wrap'] = '<a %HREF% %CLASS% %CUSTOM%><img %SRC% %IMG_CLASS% %ALT% %IMG_TITLE% %SIZE% /></a>'; } $image_args = array('img_meta' => array($attachment_data['full'], $attachment_data['width'], $attachment_data['height']), 'img_id' => empty($attachment_data['ID']) ? $attachment_data['ID'] : 0, 'alt' => $attachment_data['alt'], 'title' => $attachment_data['title'], 'img_class' => 'preload-me', 'custom' => $options['link_rel'] . ' data-dt-img-description="' . esc_attr($attachment_data['description']) . '"', 'echo' => false, 'wrap' => $options['wrap']); $class[] = 'dt-single-mfp-popup'; $class[] = 'dt-mfp-item'; // check if image has video if (empty($attachment_data['video_url'])) { $class[] = 'rollover'; $class[] = 'rollover-zoom'; $class[] = 'mfp-image'; } else { $class[] = 'video-icon'; // $blank_image = presscore_get_blank_image(); $image_args['href'] = $attachment_data['video_url']; $class[] = 'mfp-iframe'; $image_args['wrap'] = '<div class="rollover-video"><img %SRC% %IMG_CLASS% %ALT% %IMG_TITLE% %SIZE% /><a %HREF% %TITLE% %CLASS% %CUSTOM%></a></div>'; } $image_args['class'] = implode(' ', $class); $image = dt_get_thumb_img($image_args); return $image; }
$link_custom = $style; $share_buttons = presscore_get_share_buttons_for_prettyphoto('photo'); $title_args = array('img_meta' => array($title_image['full'], $title_image['width'], $title_image['height']), 'img_id' => $title_image['ID'], 'class' => $link_class, 'custom' => $link_custom . ' data-dt-img-description="' . esc_attr($title_image['description']) . '"', 'echo' => false, 'wrap' => '<a %HREF% %CLASS% %CUSTOM% %TITLE%><img %IMG_CLASS% %SRC% %IMG_TITLE% %ALT% %SIZE% /></a>'); if (count($attachments_data) == 1) { $title_args['custom'] .= $share_buttons; $title_args['class'] .= ' dt-single-mfp-popup dt-mfp-item'; } else { $title_args['class'] .= ' dt-gallery-mfp-popup'; } if ($title_image['video_url']) { $title_args['class'] .= ' mfp-iframe'; $title_args['href'] = $title_image['video_url']; } else { $title_args['class'] .= ' mfp-image'; } $media = dt_get_thumb_img($title_args); if (count($attachments_data) > 1) { if (has_post_thumbnail() && $exclude_cover) { unset($attachments_data[0]); } foreach ($attachments_data as $attachment) { $att_args = array('href' => $attachment['full'], 'custom' => '', 'alt' => $attachment['title'], 'title' => $attachment['description'], 'class' => 'mfp-image'); if (!empty($attachment['video_url'])) { $att_args['href'] = $attachment['video_url']; $att_args['class'] = 'mfp-iframe'; } $hidden_gallery .= sprintf('<a href="%s" title="%s" class="%s" data-dt-img-description="%s"%s></a>', $att_args['href'], $att_args['alt'], $att_args['class'] . ' dt-mfp-item', $att_args['title'], $att_args['custom']); } if ($hidden_gallery) { $hidden_gallery = '<div class="dt-gallery-container mfp-hide"' . $share_buttons . '>' . $hidden_gallery . '</div>'; }
/** * @param int $thumb_id * @param string $class * @return string */ function presscore_mod_albums_get_photo_img($thumb_id, $class = '') { $thumb_meta = wp_get_attachment_image_src($thumb_id, 'full'); $thumb_title = presscore_image_title_enabled($thumb_id) ? get_the_title() : ''; $thumb_args = array('echo' => false, 'img_meta' => $thumb_meta, 'img_id' => $thumb_id, 'img_class' => 'preload-me', 'class' => $class . ' dt-mfp-item', 'img_description' => get_the_content(), 'title' => $thumb_title, 'options' => presscore_set_image_dimesions(), 'wrap' => '<a %HREF% %CLASS% %TITLE% data-dt-img-description="%RAW_IMG_DESCRIPTION%" %CUSTOM%><img %IMG_CLASS% %SRC% %ALT% %SIZE% /></a>'); $video_url = presscore_get_image_video_url($thumb_id); if ($video_url) { $thumb_args['class'] .= ' mfp-iframe'; $thumb_args['href'] = $video_url; } else { $thumb_args['class'] .= ' mfp-image'; } // set proportion $thumb_args = presscore_add_thumbnail_class_for_masonry($thumb_args); return dt_get_thumb_img($thumb_args); }
<?php /** * Team post media template * * @package vogue * @since 1.0.0 */ // File Security Check if (!defined('ABSPATH')) { exit; } if (has_post_thumbnail()) { $thumb_id = get_post_thumbnail_id(); $teammate_thumb_args = array('img_meta' => wp_get_attachment_image_src($thumb_id, 'full'), 'img_id' => $thumb_id, 'options' => presscore_set_image_dimesions(), 'echo' => true, 'wrap' => '<img %IMG_CLASS% %SRC% %SIZE% %IMG_TITLE% %ALT% />'); $config = Presscore_Config::get_instance(); if ('post' == $config->get('post.open_as')) { $teammate_thumb_args['wrap'] = '<a %HREF% %CLASS%>' . $teammate_thumb_args['wrap'] . '</a>'; $teammate_thumb_args['class'] = 'rollover'; $teammate_thumb_args['href'] = get_permalink(); } else { $teammate_thumb_args['wrap'] = '<span>' . $teammate_thumb_args['wrap'] . '</span>'; } $teammate_thumb_args = presscore_add_thumbnail_class_for_masonry($teammate_thumb_args); echo '<div class="team-media">'; dt_get_thumb_img($teammate_thumb_args); echo '</div>'; }
// File Security Check if (!defined('ABSPATH')) { exit; } $config = Presscore_Config::get_instance(); $media_items = $config->get('post.media.library'); if (!$media_items) { $media_items = array(); } // add thumbnail to attachments list if (has_post_thumbnail()) { $thumbnail_id = get_post_thumbnail_id(); if (!in_array($thumbnail_id, $media_items) && $config->get('post.media.featured_image.enabled')) { array_unshift($media_items, $thumbnail_id); } } array_shift($media_items); $mini_count = 3; $image_hover = ''; foreach ($media_items as $key => $attachment_id) { $mini_image_args = array('img_meta' => wp_get_attachment_image_src($attachment_id, 'thumbnail'), 'img_id' => $attachment_id, 'img_class' => 'preload-me', 'alt' => get_post_meta($attachment_id, '_wp_attachment_image_alt', true), 'wrap' => '<img %IMG_CLASS% %SRC% %ALT% width="90" />', 'echo' => false); if ($mini_count) { $image_hover = '<span class="r-thumbn-' . $mini_count . '">' . dt_get_thumb_img($mini_image_args) . '<i></i></span>' . $image_hover; $mini_count--; } else { break; } } if ($image_hover) { echo '<span class="rollover-thumbnails">' . $image_hover . '</span>'; }