1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* FooGallery Image Viewer gallery template |
4
|
|
|
* This is the template that is run when a FooGallery shortcode is rendered to the frontend |
5
|
|
|
*/ |
6
|
|
|
//the current FooGallery that is currently being rendered to the frontend |
7
|
|
|
global $current_foogallery; |
|
|
|
|
8
|
|
|
//the current shortcode args |
9
|
|
|
global $current_foogallery_arguments; |
|
|
|
|
10
|
|
|
//get our thumbnail sizing args |
11
|
|
|
|
12
|
|
|
//get which lightbox we want to use |
13
|
|
|
$lightbox = foogallery_gallery_template_setting( 'lightbox', 'unknown' ); |
14
|
|
|
$alignment = foogallery_gallery_template_setting( 'alignment', 'fg-center' ); |
15
|
|
|
$text_prev = foogallery_gallery_template_setting( 'text-prev', __('Prev', 'foogallery') ); |
16
|
|
|
$text_of = foogallery_gallery_template_setting( 'text-of', __('of', 'foogallery') ); |
17
|
|
|
$text_next = foogallery_gallery_template_setting( 'text-next', __('Next', 'foogallery') ); |
18
|
|
|
$link = foogallery_gallery_template_setting( 'thumbnail_link', 'image' ); |
19
|
|
|
$foogallery_imageviewer_classes = foogallery_build_class_attribute_safe( $current_foogallery, 'foogallery-link-' . $link, 'foogallery-lightbox-' . $lightbox, $alignment ); |
20
|
|
|
$foogallery_imageviewer_attributes = foogallery_build_container_attributes_safe( $current_foogallery, array( 'class' => $foogallery_imageviewer_classes ) ); |
21
|
|
|
?><div <?php echo $foogallery_imageviewer_attributes; ?>> |
22
|
|
|
<div class="fiv-inner"> |
23
|
|
|
<div class="fiv-inner-container"> |
24
|
|
|
<?php foreach ( foogallery_current_gallery_attachments_for_rendering() as $attachment ) { |
25
|
|
|
echo foogallery_attachment_html( $attachment ); |
26
|
|
|
} ?> |
27
|
|
|
</div> |
28
|
|
|
<div class="fiv-ctrls"> |
29
|
|
|
<div class="fiv-prev"><span><?php echo $text_prev; ?></span></div> |
30
|
|
|
<label class="fiv-count"><span class="fiv-count-current">1</span><?php echo $text_of; ?><span class="fiv-count-total"><?php echo $current_foogallery->attachment_count(); ?></span></label> |
31
|
|
|
<div class="fiv-next"><span><?php echo $text_next; ?></span></div> |
32
|
|
|
</div> |
33
|
|
|
</div> |
34
|
|
|
</div> |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state