-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgallery-single-template.php
More file actions
executable file
·134 lines (133 loc) · 7.09 KB
/
gallery-single-template.php
File metadata and controls
executable file
·134 lines (133 loc) · 7.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
/* Woggle 4 Wordpress Remix
*
* Woggle 4 Wordpress Remix is a free Wordpress theme derived from Woggle 4 Wordpress
* developed by hawesWeb Productions available at iscout4wordpress.org.uk
*
* Woggle 4 Wordpress Remix is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Woggle 4 Wordpress Remix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Woggle 4 Wordpress Remix. If not, see <http://www.gnu.org/licenses/>.
*
*/
?>
<?php get_header(); ?>
<div id="container" class="site-content">
<div role="main" id="content" class="hentry">
<?php
global $post, $wp_query;
$args = array(
'post_type' => 'gallery',
'post_status' => 'publish',
'name' => $wp_query->query_vars['name'],
'posts_per_page' => 1
);
$second_query = new WP_Query( $args );
$gllr_options = get_option( 'gllr_options' );
if ($second_query->have_posts()) : while ($second_query->have_posts()) : $second_query->the_post(); ?>
<h1 class="home_page_title entry-header"><?php the_title(); ?></h1>
<div class="gallery_box_single entry-content">
<?php the_content();
$posts = get_posts(array(
"showposts" => -1,
"what_to_show" => "posts",
"post_status" => "inherit",
"post_type" => "attachment",
"orderby" => $gllr_options['order_by'],
"order" => $gllr_options['order'],
"post_mime_type"=> "image/jpeg,image/gif,image/jpg,image/png",
"post_parent" => $post->ID
));
if( count( $posts ) > 0 ) {
$count_image_block = 0; ?>
<div class="gallery clearfix">
<?php foreach( $posts as $attachment ) {
$key = "gllr_image_text";
$link_key = "gllr_link_url";
$image_attributes = wp_get_attachment_image_src( $attachment->ID, 'photo-thumb' );
$image_attributes_large = wp_get_attachment_image_src( $attachment->ID, 'large' );
$image_attributes_full = wp_get_attachment_image_src( $attachment->ID, 'full' );
if( 1 == $gllr_options['border_images'] ){
$gllr_border = 'border-width: '.$gllr_options['border_images_width'].'px; border-color:'.$gllr_options['border_images_color'].'';
$gllr_border_images = $gllr_options['border_images_width'] * 2;
}
else{
$gllr_border = '';
$gllr_border_images = 0;
}
if( $count_image_block % $gllr_options['custom_image_row_count'] == 0 ) { ?>
<div class="gllr_image_row">
<?php } ?>
<div class="gllr_image_block">
<p style="width:<?php echo $gllr_options['gllr_custom_size_px'][1][0]+$gllr_border_images; ?>px;height:<?php echo $gllr_options['gllr_custom_size_px'][1][1]+$gllr_border_images; ?>px;">
<?php if( ( $url_for_link = get_post_meta( $attachment->ID, $link_key, true ) ) != "" ) { ?>
<a href="<?php echo $url_for_link; ?>" title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>" target="_blank">
<img style="width:<?php echo $gllr_options['gllr_custom_size_px'][1][0]; ?>px;height:<?php echo $gllr_options['gllr_custom_size_px'][1][1]; ?>px; <?php echo $gllr_border; ?>" alt="" title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>" src="<?php echo $image_attributes[0]; ?>" />
</a>
<?php } else { ?>
<a rel="gallery_fancybox" href="<?php echo $image_attributes_large[0]; ?>" title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>" >
<img style="width:<?php echo $gllr_options['gllr_custom_size_px'][1][0]; ?>px;height:<?php echo $gllr_options['gllr_custom_size_px'][1][1]; ?>px; <?php echo $gllr_border; ?>" alt="" title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>" src="<?php echo $image_attributes[0]; ?>" rel="<?php echo $image_attributes_full[0]; ?>" />
</a>
<?php } ?>
</p>
<div style="width:<?php echo $gllr_options['gllr_custom_size_px'][1][0]+$gllr_border_images; ?>px; <?php if( 0 == $gllr_options["image_text"] ) echo "visibility:hidden;"; ?>" class="gllr_single_image_text"><?php echo get_post_meta( $attachment->ID, $key, true ); ?> </div>
</div>
<?php if($count_image_block%$gllr_options['custom_image_row_count'] == $gllr_options['custom_image_row_count']-1 ) { ?>
</div>
<?php }
$count_image_block++;
}
if($count_image_block > 0 && $count_image_block%$gllr_options['custom_image_row_count'] != 0) { ?>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
<div class="clear"></div>
<?php endwhile; else: ?>
<div class="gallery_box_single">
<p class="not_found"><?php _e('Sorry, nothing found.', 'gallery'); ?></p>
</div>
<?php endif; ?>
<?php if ( 1 == $gllr_options['return_link'] ) {
if( 'gallery_template_url' == $gllr_options["return_link_page"] ){
global $wpdb;
$parent = $wpdb->get_var( "SELECT $wpdb->posts.ID FROM $wpdb->posts, $wpdb->postmeta WHERE meta_key = '_wp_page_template' AND meta_value = 'gallery-template.php' AND (post_status = 'publish' OR post_status = 'private') AND $wpdb->posts.ID = $wpdb->postmeta.post_id" ); ?>
<div class="return_link"><a href="<?php echo ( !empty( $parent ) ? get_permalink( $parent ) : '' ); ?>"><?php echo $gllr_options['return_link_text']; ?></a></div>
<?php } else { ?>
<div class="return_link"><a href="<?php echo $gllr_options["return_link_url"]; ?>"><?php echo $gllr_options['return_link_text']; ?></a></div>
<?php }
} ?>
<?php comments_template(); ?>
</div>
</div>
<?php get_sidebar(); ?>
<script type="text/javascript">
(function($){
$(document).ready(function(){
$("a[rel=gallery_fancybox]").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'titlePosition' : 'inside',
'speedIn' : 500,
'speedOut' : 300,
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-inside">' + (title.length ? title + '<br />' : '') + '<?php _e( "Image", "gallery"); ?> ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span><?php if( get_post_meta( $post->ID, 'gllr_download_link', true ) != '' ){?><br /><a href="'+$(currentOpts.orig).attr('rel')+'" target="_blank"><?php echo __('Download high resolution image', 'gallery'); ?> </a><?php } ?>';
}<?php if( $gllr_options['start_slideshow'] == 1 ) { ?>,
'onComplete': function() {
clearTimeout(jQuery.fancybox.slider);
jQuery.fancybox.slider=setTimeout("jQuery.fancybox.next()",<?php echo empty( $gllr_options['slideshow_interval'] )? 2000 : $gllr_options['slideshow_interval'] ; ?>);
}<?php } ?>
});
});
})(jQuery);
</script>
<?php get_footer(); ?>