|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* FooGallery single thumbnail gallery template |
|
4
|
|
|
*/ |
|
5
|
|
|
global $current_foogallery; |
|
|
|
|
|
|
6
|
|
|
global $current_foogallery_arguments; |
|
|
|
|
|
|
7
|
|
|
$args = foogallery_gallery_template_setting( 'thumbnail_dimensions', array() ); |
|
|
|
|
|
|
8
|
|
|
if ( !array_key_exists( 'crop', $args ) ) { |
|
9
|
|
|
$args['crop'] = '1'; //we now force thumbs to be cropped by default |
|
10
|
|
|
} |
|
11
|
|
|
$lightbox = foogallery_gallery_template_setting( 'lightbox', 'unknown' ); |
|
12
|
|
|
$position = foogallery_gallery_template_setting( 'position', 'fg-center' ); |
|
13
|
|
|
|
|
14
|
|
|
$caption_bgcolor = foogallery_gallery_template_setting( 'caption_bgcolor', 'rgba(0, 0, 0, 0.8)' ); |
|
15
|
|
|
$caption_color = foogallery_gallery_template_setting( 'caption_color', '#fff' ); |
|
16
|
|
|
$featured_attachment = $current_foogallery->featured_attachment( $args ); |
|
17
|
|
|
$args['override_caption_title'] = foogallery_gallery_template_setting( 'caption_title', '' ); |
|
18
|
|
|
$args['override_caption_desc'] = foogallery_gallery_template_setting( 'caption_description', '' ); |
|
19
|
|
|
|
|
20
|
|
|
$thumb_url = $featured_attachment->url; |
|
21
|
|
|
if ( foogallery_gallery_template_setting( 'link_custom_url', '' ) == 'on' ) { |
|
22
|
|
|
if ( !empty( $featured_attachment->custom_url ) ) { |
|
23
|
|
|
$thumb_url = $featured_attachment->custom_url; |
|
24
|
|
|
} |
|
25
|
|
|
$args['link'] = 'custom'; |
|
26
|
|
|
} |
|
27
|
|
|
$args['link_attributes'] = array( |
|
28
|
|
|
'rel' => 'lightbox[' . $current_foogallery->ID . ']' |
|
29
|
|
|
); |
|
30
|
|
|
$foogallery_single_thumbnail_classes = foogallery_build_class_attribute_safe( $current_foogallery, 'foogallery-single-thumbnail', 'foogallery-lightbox-' . $lightbox, $position ); |
|
31
|
|
|
$foogallery_single_thumbnail_attributes = foogallery_build_container_attributes_safe( $current_foogallery, array( 'class' => $foogallery_single_thumbnail_classes ) ); |
|
32
|
|
|
?> |
|
33
|
|
|
<div <?php echo $foogallery_single_thumbnail_attributes; ?>> |
|
34
|
|
|
<?php echo foogallery_attachment_html( $featured_attachment, $args ); ?> |
|
|
|
|
|
|
35
|
|
|
<div class="fg-st-hidden"> |
|
36
|
|
|
<?php |
|
37
|
|
|
unset( $args['override_caption_title'] ); |
|
38
|
|
|
unset( $args['override_caption_desc'] ); |
|
39
|
|
|
foreach ( foogallery_current_gallery_attachments_for_rendering() as $attachment ) { |
|
40
|
|
|
if ( $attachment->ID !== $featured_attachment->ID ) { |
|
41
|
|
|
echo foogallery_attachment_html( $attachment, $args ); |
|
|
|
|
|
|
42
|
|
|
} |
|
43
|
|
|
} ?> |
|
44
|
|
|
</div> |
|
45
|
|
|
</div> |
|
46
|
|
|
|
Instead of relying on
globalstate, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state