PluginProbe ʕ •ᴥ•ʔ
Gallery : FooGallery / 3.3.0
Gallery : FooGallery v3.3.0
3.3.2 3.3.3 3.3.0 3.1.31 3.1.32 3.1.34 3.1.36 3.2.0 3.2.6 trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / extensions / default-templates / thumbnail / gallery-thumbnail.php
foogallery / extensions / default-templates / thumbnail Last commit date
js 1 week ago class-thumbnail-gallery-template.php 1 week ago gallery-thumbnail.php 1 week ago
gallery-thumbnail.php
73 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 /**
8 * FooGallery single thumbnail gallery template
9 */
10 global $current_foogallery;
11
12 $lightbox = foogallery_gallery_template_setting_lightbox();
13 $position = foogallery_gallery_template_setting( 'position', 'fg-center' );
14 $link_custom_url = foogallery_gallery_template_setting( 'link_custom_url' );
15 $show_as_stack = foogallery_gallery_template_setting( 'show_as_stack' );
16
17 $featured_attachment = $current_foogallery->featured_attachment();
18 $featured_attachment->featured = true;
19
20 $args = foogallery_gallery_template_arguments();
21 $args['override_caption_title'] = foogallery_format_caption_text( foogallery_gallery_template_setting( 'caption_title', '' ) );
22 $args['override_caption_desc'] = foogallery_format_caption_text( foogallery_gallery_template_setting( 'caption_description', '' ) );
23
24 if ( 'on' === $link_custom_url && '' !== $lightbox && ! empty( $featured_attachment->custom_url ) ) {
25 $featured_attachment->type = 'iframe';
26 }
27
28 $foogallery_single_thumbnail_classes = foogallery_build_class_attribute_safe( $current_foogallery, 'foogallery-single-thumbnail', 'foogallery-lightbox-' . $lightbox, $position, $show_as_stack );
29 $foogallery_single_thumbnail_attributes = foogallery_build_container_attributes_safe( $current_foogallery, array( 'class' => $foogallery_single_thumbnail_classes ) );
30
31 // Get 2 arrays of attachments for this gallery.
32 // 1 will not be hidden (if show_as_stack is enabled)
33 // and the other will be the default hidden ones, so that they show up in the lightbox.
34 $attachments_not_hidden = array();
35 $attachments_hidden = array();
36 $always_hide = false;
37
38 foreach ( foogallery_current_gallery_attachments_for_rendering() as $attachment ) {
39 // We can skip the featured attachment.
40 if ( $attachment->url === $featured_attachment->url ) {
41 continue;
42 }
43
44 if ( !$always_hide && 'fg-stacked' === $show_as_stack ) {
45 $attachments_not_hidden[] = $attachment;
46 } else {
47 $attachments_hidden[] = $attachment;
48 }
49
50 // If only want to not hide 2 attachments, then set always_hide to true.
51 if ( count( $attachments_not_hidden ) >= 2 ) {
52 $always_hide = true;
53 }
54 }
55
56
57 ?>
58 <div <?php echo $foogallery_single_thumbnail_attributes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
59 <?php echo foogallery_attachment_html( $featured_attachment, $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
60 <?php
61 foreach ( $attachments_not_hidden as $attachment ) {
62 echo foogallery_attachment_html( $attachment ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
63 }
64 ?>
65 <div class="fg-st-hidden">
66 <?php
67 foreach ( $attachments_hidden as $attachment ) {
68 echo foogallery_attachment_html( $attachment ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
69 }
70 ?>
71 </div>
72 </div>
73