|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* FooGallery default responsive album template |
|
4
|
|
|
*/ |
|
5
|
|
|
global $current_foogallery_album; |
|
6
|
|
|
global $current_foogallery_album_arguments; |
|
7
|
|
|
global $current_foogallery; |
|
|
|
|
|
|
8
|
|
|
$gallery = foogallery_album_get_current_gallery(); |
|
9
|
|
|
$alignment = foogallery_album_template_setting( 'alignment', 'alignment-left' ); |
|
10
|
|
|
$foogallery = false; |
|
11
|
|
|
|
|
12
|
|
|
if ( !empty( $gallery ) ) { |
|
13
|
|
|
$foogallery = FooGallery::get_by_slug( $gallery ); |
|
14
|
|
|
|
|
15
|
|
|
//check to see if the gallery belongs to the album |
|
16
|
|
|
if ( !$current_foogallery_album->includes_gallery( $foogallery->ID ) ) { |
|
17
|
|
|
$foogallery = false; |
|
18
|
|
|
} |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
if ( false !== $foogallery ) { |
|
22
|
|
|
$album_url = foogallery_album_remove_gallery_from_link(); |
|
23
|
|
|
$gallery_title_size = foogallery_album_template_setting('gallery_title_size', 'h2'); |
|
24
|
|
|
echo '<div id="' . $current_foogallery_album->slug . '" class="foogallery-album-header">'; |
|
25
|
|
|
echo '<p><a href="' . esc_url( $album_url ) . '">' . foogallery_get_setting( 'language_back_to_album_text', __( '« back to album', 'foogallery' ) ) . '</a></p>'; |
|
26
|
|
|
echo '<' . $gallery_title_size . '>' . $foogallery->name . '</'. $gallery_title_size . '>'; |
|
27
|
|
|
echo apply_filters('foogallery_album_default_gallery_content', '', $foogallery); |
|
28
|
|
|
echo '</div>'; |
|
29
|
|
|
echo do_shortcode('[foogallery id="' . $foogallery->ID . '"]'); |
|
30
|
|
|
} else { |
|
31
|
|
|
$title_bg = foogallery_album_template_setting( 'title_bg', '#ffffff' ); |
|
32
|
|
|
$title_font_color = foogallery_album_template_setting( 'title_font_color', '#000000' ); |
|
33
|
|
|
$args = foogallery_album_template_setting( 'thumbnail_dimensions', array() ); |
|
34
|
|
|
if ( !empty( $title_bg ) || !empty( $title_font_color ) ) { |
|
35
|
|
|
echo '<style type="text/css">'; |
|
36
|
|
|
if ( !empty( $title_bg ) ) { |
|
37
|
|
|
echo '.foogallery-album-gallery-list .foogallery-pile h3 { background: ' . $title_bg . ' !important; }'; |
|
38
|
|
|
} |
|
39
|
|
|
if ( !empty( $title_font_color ) ) { |
|
40
|
|
|
echo '.foogallery-album-gallery-list .foogallery-pile h3 { color: ' . $title_font_color . ' !important; }'; |
|
41
|
|
|
} |
|
42
|
|
|
echo '</style>'; |
|
43
|
|
|
} |
|
44
|
|
|
?> |
|
45
|
|
|
<div id="foogallery-album-<?php echo $current_foogallery_album->ID; ?>"> |
|
46
|
|
|
<ul class="foogallery-album-gallery-list <?php echo $alignment; ?>"> |
|
47
|
|
|
<?php |
|
48
|
|
|
foreach ( $current_foogallery_album->galleries() as $gallery ) { |
|
49
|
|
|
$current_foogallery = $gallery; |
|
50
|
|
|
if (!empty($gallery->attachment_ids)) { |
|
51
|
|
|
$attachment = $gallery->featured_attachment(); |
|
52
|
|
|
|
|
53
|
|
|
if ( false === $attachment ) continue; |
|
54
|
|
|
|
|
55
|
|
|
$img_html = $attachment->html_img( $args ); |
|
56
|
|
|
$images = $gallery->image_count(); |
|
57
|
|
|
$gallery_link = foogallery_album_build_gallery_link( $current_foogallery_album, $gallery ); |
|
58
|
|
|
$gallery_link_target = foogallery_album_build_gallery_link_target( $current_foogallery_album, $gallery ); |
|
59
|
|
|
?> |
|
60
|
|
|
<li> |
|
61
|
|
|
<div class="foogallery-pile"> |
|
62
|
|
|
<div class="foogallery-pile-inner"> |
|
63
|
|
|
<a href="<?php echo esc_url( $gallery_link ); ?>" target="<?php echo $gallery_link_target; ?>"> |
|
64
|
|
|
<?php echo $img_html; ?> |
|
65
|
|
|
<?php |
|
66
|
|
|
|
|
67
|
|
|
$title = empty( $gallery->name ) ? |
|
68
|
|
|
sprintf( __( '%s #%s', 'foogallery' ), foogallery_plugin_name(), $gallery->ID ) : |
|
69
|
|
|
$gallery->name; |
|
70
|
|
|
|
|
71
|
|
|
?> |
|
72
|
|
|
<h3><?php echo $title; ?> |
|
73
|
|
|
<span><?php echo $images; ?></span> |
|
74
|
|
|
</h3> |
|
75
|
|
|
</a> |
|
76
|
|
|
</div> |
|
77
|
|
|
</div> |
|
78
|
|
|
</li> |
|
79
|
|
|
<?php } ?> |
|
80
|
|
|
<?php } ?> |
|
81
|
|
|
</ul> |
|
82
|
|
|
<div style="clear: both;"></div> |
|
83
|
|
|
</div> |
|
84
|
|
|
<?php } |
|
85
|
|
|
|
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