<?php get_template_part('includes/post-standard-header'); ?> <?php if (has_post_thumbnail()) { ?> <div class="post-media"> <?php $img = om_get_post_thumbnail('post-media-large', false); echo om_hover_extras($img['html'], $img['full_image'][0], get_permalink()); ?> </div> <?php } ?> <?php get_template_part('includes/post-standard-footer');
<?php get_template_part('includes/post-standard-header'); ?> <?php $quote = get_post_meta($post->ID, OM_THEME_SHORT_PREFIX . 'quote', true); $author = get_post_meta($post->ID, OM_THEME_SHORT_PREFIX . 'quote_author', true); if ($quote) { echo '<div class="blockquote"><div class="blockquote-inner">' . wp_kses_post($quote) . '</div>' . ($author ? '<div class="blockquote-author">' . esc_html($author) . '</div>' : '') . '</div>'; } ?> <?php if (has_post_thumbnail()) { ?> <div class="post-media"> <?php $img = om_get_post_thumbnail('post-media-small', false); echo om_hover_extras($img['html'], false, get_permalink()); ?> </div> <?php } ?> <?php get_template_part('includes/post-standard-footer');
} else { if (!empty($atts['img_link'])) { // backward compatibility. will be removed in 4.7+ $link_to = $atts['img_link']; if (!preg_match('/^(https?\\:\\/\\/|\\/\\/)/', $link_to)) { $link_to = 'http://' . $link_to; } } } } //to disable relative links uncomment this.. $img_output = 'vc_box_shadow_3d' === $style ? '<span class="vc_box_shadow_3d_wrap">' . $img['thumbnail'] . '</span>' : $img['thumbnail']; //$image_string = ! empty( $link_to ) ? '<a' . $a_class . ' href="' . $link_to . '"' . ' target="' . $img_link_target . '"' . '><div class="vc_single_image-wrapper ' . $style . ' ' . $border_color . '">' . $img_output . '</div></a>' : '<div class="vc_single_image-wrapper ' . $style . ' ' . $border_color . '">' . $img_output . '</div>'; if ($link_to) { if ($img_link_large == true) { $img_output = om_hover_extras($img_output, $link_to, false, 'target="' . $img_link_target . '"'); } else { $img_output = om_hover_extras($img_output, false, $link_to, false, 'target="' . $img_link_target . '"'); } } $image_string = '<div class="vc_single_image-wrapper ' . $style . ' ' . $border_color . '">' . $img_output . '</div>'; $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'wpb_single_image wpb_content_element' . $el_class . vc_shortcode_custom_css_class($css, ' '), $this->settings['base'], $atts); $css_class .= $this->getCSSAnimation($css_animation); $css_class .= ' vc_align_' . $alignment; $output .= "\n\t" . '<div class="' . esc_attr($css_class) . '">'; $output .= "\n\t\t" . '<div class="wpb_wrapper">'; $output .= "\n\t\t\t" . wpb_widget_title(array('title' => $title, 'extraclass' => 'wpb_singleimage_heading')); $output .= "\n\t\t\t" . $image_string; $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.wpb_wrapper'); $output .= "\n\t" . '</div> ' . $this->endBlockComment($this->getShortcode()); echo $output;
function om_get_gallery_grid($attachments, $args = array()) { $args = wp_parse_args($args, array('columns' => 3, 'ratio' => '3:2', 'show_captions' => false, 'custom_gallery_field_name' => false, 'link_to' => 'file', 'url_link' => false, 'links' => false, 'url_link_target' => false, 'hires' => false)); if (empty($attachments)) { return ''; } if (!is_array($attachments)) { // that means that passed not attachments array but post id $attachments = intval($attachments); if (!$attachments) { return ''; } $attachments = om_get_post_gallery_images($attachments, array('custom_gallery_field_name' => $args['custom_gallery_field_name'])); } if ($args['url_link_target'] == '_blank') { $args['url_link_target'] = ' target="_blank"'; } else { $args['url_link_target'] = ''; } $args['columns'] = intval($args['columns']); if (!$args['columns']) { $args['columns'] = 3; } elseif ($args['columns'] > 9) { $args['columns'] = 9; } $args['ratio'] = explode(':', $args['ratio']); if (count($args['ratio']) < 2 || !$args['ratio'][0] || !$args['ratio'][1]) { $args['ratio'] = 3 / 2; } else { $args['ratio'] = $args['ratio'][0] / $args['ratio'][1]; } global $_OM_THEME_THUMBNAIL_SIZES; $out = ''; if (!empty($attachments)) { if ($args['link_to'] == 'none' || $args['link_to'] == 'post' || $args['link_to'] == 'custom_link') { $use_link = false; } else { $use_link = !(get_option(OM_THEME_PREFIX . 'prettyphoto_lightbox') == 'disabled_no_action'); } $gallery_unique_id = rand(0, getrandmax()); $out .= '<div class="gallery-grid' . ($args['show_captions'] ? ' gallery-with-captions' : ' gallery-without-captions') . ' gallery-columns-' . $args['columns'] . '" data-gallery-columns="' . $args['columns'] . '"><div class="items">'; $i = 0; foreach ($attachments as $attachment) { $src_full = wp_get_attachment_image_src($attachment->ID, 'full'); $alt = trim(strip_tags(get_post_meta($attachment->ID, '_wp_attachment_image_alt', true))); if (empty($alt)) { $alt = trim(strip_tags($attachment->post_excerpt)); } // If not, Use the Caption if (empty($alt)) { $alt = trim(strip_tags($attachment->post_title)); } // Finally, use the title $caption = ''; if ($args['show_captions']) { $caption = trim(strip_tags($attachment->post_excerpt)); if (empty($caption)) { $caption = trim(strip_tags($attachment->post_title)); } } $size_postfix = $args['columns'] . ($args['hires'] ? '-hires' : ''); $_OM_THEME_THUMBNAIL_SIZES['grid-gallery-' . $size_postfix] = $_OM_THEME_THUMBNAIL_SIZES['masonry-gallery-' . $size_postfix]; $_OM_THEME_THUMBNAIL_SIZES['grid-gallery-' . $size_postfix]['height'] = $_OM_THEME_THUMBNAIL_SIZES['grid-gallery-' . $size_postfix]['width'] / $args['ratio']; $_OM_THEME_THUMBNAIL_SIZES['grid-gallery-' . $size_postfix]['crop'] = true; $src = om_img_resize($src_full[0], 'grid-gallery-' . $size_postfix, false); if (!$src) { $src = $src_full; } if (get_option(OM_THEME_PREFIX . 'lazyload') == 'true') { $img = '<img height="' . $src[2] . '" width="' . $src[1] . '" src="' . TEMPLATE_DIR_URI . '/img/e.gif" data-original="' . $src[0] . '" alt="' . htmlspecialchars($alt) . '" class="lazyload" />'; } else { $img = '<img height="' . $src[2] . '" width="' . $src[1] . '" src="' . $src[0] . '" alt="' . htmlspecialchars($alt) . '" />'; } if ($args['link_to'] == 'post') { $args['url_link'] = get_permalink($attachment->ID); } elseif ($args['link_to'] == 'custom_link') { if (isset($args['links'][$i])) { $args['url_link'] = $args['links'][$i]; } else { $args['url_link'] = false; } } $img_html = om_hover_extras($img . ($caption != '' ? '<span class="item-caption">' . $caption . '</span>' : ''), $use_link ? $src_full[0] : false, $args['url_link'], 'rel="prettyPhoto[postgal_' . $gallery_unique_id . ']"', $args['url_link_target']); $out .= '<div class="item" rel="slide-' . $attachment->ID . '">' . $img_html . '</div> '; if (($i + 1) % $args['columns'] == 0) { $out .= '<div class="clear"></div>'; } $i++; } $out .= '</div><div class="clear"></div></div>'; } return $out; }
?> <h4 class="post-title"> <?php echo empty($link_setting) || $link_setting != 'no_link' ? $this->getLinked($post, $post->title, $link_setting, 'link_title') : $post->title; ?> </h4> <?php } elseif ($block === 'image' && !empty($post->thumbnail)) { ?> <div class="post-thumb"> <?php if (empty($link_setting) || $link_setting != 'no_link') { if ($link_setting === 'link_post' || empty($link_setting)) { echo om_hover_extras($post->thumbnail, false, get_permalink($post->id), '', $this->link_target); } elseif ($link_setting === 'link_image' && isset($post->image_link) && !empty($post->image_link)) { echo om_hover_extras($post->thumbnail, $post->image_link, false, $this->link_target); } else { echo $post->thumbnail; // no need to escape } } else { echo $post->thumbnail; // no need to escape } ?> </div> <?php } elseif ($block === 'text') { ?> <div class="entry-content"> <?php