| 1 |
<?php get_header(); ?> |
| 2 |
<div id="container"> |
| 3 |
<div role="main" id="content"> |
| 4 |
<?php |
| 5 |
global $post; |
| 6 |
$args = array( |
| 7 |
'post_type' => 'gallery', |
| 8 |
'post_status' => 'publish', |
| 9 |
'name' => substr(basename( $_SERVER['REQUEST_URI'] ), strpos( basename( $_SERVER['REQUEST_URI'] ), "=")), |
| 10 |
'posts_per_page' => 1 |
| 11 |
); |
| 12 |
$second_query = new WP_Query( $args ); |
| 13 |
$gllr_options = get_option( 'gllr_options' ); |
| 14 |
if ($second_query->have_posts()) : while ($second_query->have_posts()) : $second_query->the_post(); ?> |
| 15 |
<h1 class="home_page_title"><?php the_title(); ?></h1> |
| 16 |
<div class="gallery_box_single"> |
| 17 |
<?php the_content(); |
| 18 |
$posts = get_posts(array( |
| 19 |
"showposts" => -1, |
| 20 |
"what_to_show" => "posts", |
| 21 |
"post_status" => "inherit", |
| 22 |
"post_type" => "attachment", |
| 23 |
"orderby" => "menu_order", |
| 24 |
"order" => "ASC", |
| 25 |
"post_mime_type"=> "image/jpeg,image/gif,image/jpg,image/png", |
| 26 |
"post_parent" => $post->ID |
| 27 |
)); |
| 28 |
if( count( $posts ) > 0 ) { |
| 29 |
$count_image_block = 0; ?> |
| 30 |
<div class="gallery clearfix"> |
| 31 |
<?php foreach( $posts as $attachment ) { |
| 32 |
$key = "gllr_image_text"; |
| 33 |
$image_attributes = wp_get_attachment_image_src( $attachment->ID, 'photo-thumb' ); |
| 34 |
$image_attributes_large = wp_get_attachment_image_src( $attachment->ID, 'large' ); |
| 35 |
if( $count_image_block % $gllr_options['custom_image_row_count'] == 0 ) { ?> |
| 36 |
<div class="gllr_image_row"> |
| 37 |
<?php } ?> |
| 38 |
<div class="gllr_image_block"> |
| 39 |
<p style="width:<?php echo $gllr_options['gllr_custom_size_px'][1][0]+20; ?>px;height:<?php echo $gllr_options['gllr_custom_size_px'][1][1]+20; ?>px;"> |
| 40 |
<a rel="gallery_fancybox" href="<?php echo $image_attributes_large[0]; ?>" title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>"> |
| 41 |
<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;" alt="" title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>" src="<?php echo $image_attributes[0]; ?>" /> |
| 42 |
</a> |
| 43 |
</p> |
| 44 |
<div style="width:<?php echo $gllr_options['gllr_custom_size_px'][1][0]+20; ?>px;" class="gllr_single_image_text"><?php echo get_post_meta( $attachment->ID, $key, true ); ?> </div> |
| 45 |
</div> |
| 46 |
<?php if($count_image_block%$gllr_options['custom_image_row_count'] == $gllr_options['custom_image_row_count']-1 ) { ?> |
| 47 |
</div> |
| 48 |
<?php } |
| 49 |
$count_image_block++; |
| 50 |
} |
| 51 |
if($count_image_block > 0 && $count_image_block%$gllr_options['custom_image_row_count'] != 0) { ?> |
| 52 |
</div> |
| 53 |
<?php } ?> |
| 54 |
</div> |
| 55 |
<?php } ?> |
| 56 |
</div> |
| 57 |
<div class="clear"></div> |
| 58 |
<?php endwhile; else: ?> |
| 59 |
<div class="gallery_box_single"> |
| 60 |
<p class="not_found"><?php _e('Sorry - nothing to found.', 'gallery'); ?></p> |
| 61 |
</div> |
| 62 |
<?php endif; ?> |
| 63 |
</div> |
| 64 |
</div> |
| 65 |
<?php get_sidebar(); ?> |
| 66 |
<script type="text/javascript"> |
| 67 |
(function($){ |
| 68 |
$(document).ready(function(){ |
| 69 |
$("a[rel=gallery_fancybox]").fancybox({ |
| 70 |
'transitionIn' : 'elastic', |
| 71 |
'transitionOut' : 'elastic', |
| 72 |
'titlePosition' : 'inside', |
| 73 |
'speedIn' : 500, |
| 74 |
'speedOut' : 300, |
| 75 |
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) { |
| 76 |
return '<span id="fancybox-title-inside">' + (title.length ? title + '<br />' : '') + 'Image ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span>'; |
| 77 |
} |
| 78 |
}); |
| 79 |
}); |
| 80 |
})(jQuery); |
| 81 |
</script> |
| 82 |
<?php get_footer(); ?> |