public function rectangular_talavera($srcs, $width = 1, $container = true, $fancybox = true, $post_ids = array()) { $linked_to_posts = count($post_ids); $grouper = $this->pht_talavera($srcs, $width); $skip_resize_array = apply_filters('phtpb_do_not_resize_in_gallery', array('image/gif')); $output = ''; $i = 0; if ($container) { $output = '<div class="pht-gallery">'; } $row_count = 0; foreach ($grouper->grouped_images as $row) { $row_count++; $row_count_class = 1 < $row_count ? 'pht-gallery__row--not1st' : ''; $output .= '<div class="pht-gallery__row" style="' . esc_attr('width:100%; padding-bottom: ' . $row->height / $row->width * 100 . '%;') . '"><div class="pht-gallery__group-container">'; $group_count = 0; foreach ($row->groups as $group) { $group_count++; $count = count($group->images); $output .= '<div class="pht-gallery__group images-' . esc_attr($count) . '" style="' . esc_attr('width: ' . $group->width / $row->width * 100 . '%; padding-bottom: ' . $group->height / $group->width * 100 . '%;') . '">'; $item_count = 0; foreach ($group->images as $image) { $item_count++; $item_count_class = 1 < $item_count || 1 < $row_count ? 'pht-gallery__item--not1stt' : ''; $link_count_class = 1 < $item_count || 1 < $row_count ? ' pht-gallery__link--not1stt' : ''; $item_count_class .= 1 < $group_count ? ' pht-gallery__item--not1stl' : ''; $link_count_class .= 1 < $group_count ? ' pht-gallery__link--not1stl' : ''; $size = 'large'; if ($image->width < 150) { $size = 'tiny'; } if ($image->width < 250) { $size = 'small'; } $image_title = $image->post_title; $orig_file = wp_get_attachment_url($image->ID); $link = $this->get_attachment_link($image->ID, $orig_file); $original_image = wp_get_attachment_image_src($image->ID, 'full'); $original_image_url = $original_image[0]; $figure_class = 'pht-gallery__item pht-gallery__item-' . esc_attr($size) . ' ' . $item_count_class; $output .= "<figure class='pht-fig {$figure_class} js-pht-waypoint pht-waypoint pht-fadesat'>"; $output .= PeHaa_Themes_Page_Builder_Shortcode_Template::get_att_img($image->ID, array($image->width, $image->height), array('width' => intval($image->width), 'height' => intval($image->height)), $skip_resize_array); $link_class = $link_count_class . ' pht-fig__link--main pht-fig__link--hoverdir'; if ($linked_to_posts) { $output .= "<a href='" . esc_url(get_permalink($post_ids[$i])) . "' class='pht-fig__link pht-fig__link--main pht-fig__link--main {$link_class}'></a>"; $output .= sprintf('<%1$s class="%2$s">%3$s</%1$s>', esc_attr(apply_filters('phtpb_showcase_title_tag', 'div')), esc_attr(apply_filters('phtpb_showcase_title_class', 'pht-fig__titles pht-epsilon')), esc_html(get_the_title($post_ids[$i]))); $link_class = 'pht-fig__link--secondary'; $i++; } else { if (trim($image->post_excerpt)) { $output .= '<figcaption class="pht-gallery__caption pht-transition">' . wptexturize($image->post_excerpt) . '</figcaption>'; } } if ($fancybox) { $lightbox_icon_class = apply_filters('phtpb_lightbox_icon_class', 'pht-ic-f1-arrow-expand-alt'); $output .= "<a href='{$orig_file}' class='pht-fig__link js-pht-magnific_popup {$link_class} {$link_count_class} a-a a-a--no-h'><i class='pht-fig__link__string {$lightbox_icon_class}'></i></a>"; } $output .= '</figure>'; } $output .= '</div>' . "\n"; } $output .= '</div></div>' . "\n"; } if ($container) { $output .= '</div><!-- .gallery -->' . "\n"; } return $output; }