-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtemplate-gallery-flow.php
executable file
·124 lines (104 loc) · 3.04 KB
/
template-gallery-flow.php
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
<?php
/**
* The main template file for display portfolio page.
*
* Template Name: Gallery Image Flow
* @package WordPress
*/
/**
* Get all photos
**/
$menu_sets_query = '';
$portfolio_items = -1;
/**
* Get Current page object
**/
$page = get_page($post->ID);
$current_page_id = '';
if(isset($page->ID))
{
$current_page_id = $page->ID;
}
//Check if password protected
$portfolio_password = get_post_meta($current_page_id, 'portfolio_password', true);
if(!empty($portfolio_password))
{
session_start();
if(!isset($_SESSION['gallery_page_'.$current_page_id]) OR empty($_SESSION['gallery_page_'.$current_page_id]))
{
include (get_template_directory() . "/templates/template-password.php");
exit;
}
}
//Get content gallery
$gallery_id = get_post_meta($current_page_id, 'page_gallery_id', true);
$args = array(
'post_type' => 'attachment',
'numberposts' => $portfolio_items,
'post_status' => null,
'post_parent' => $gallery_id,
'order' => 'ASC',
'orderby' => 'menu_order',
);
//Get gallery images
$all_photo_arr = get_posts( $args );
get_header(); ?>
<div id="imageFlow">
<div class="text">
<div class="title">Loading</div>
<div class="legend">Please wait...</div>
</div>
</div>
<div id="fancy_gallery" style="display:none">
<?php
$pp_portfolio_enable_slideshow_title = get_option('pp_portfolio_enable_slideshow_title');
foreach($all_photo_arr as $key => $photo)
{
$full_image_url = wp_get_attachment_image_src( $photo->ID, 'full' );
$small_image_url = wp_get_attachment_image_src( $photo->ID, 'large' );
?>
<a id="fancy_gallery<?php echo $key; ?>" href="<?php echo $full_image_url[0]; ?>" class="fancy-gallery" <?php if(!empty($pp_portfolio_enable_slideshow_title)) { ?> title="<?php echo $photo->post_title; ?>" <?php } ?>></a>
<?php
}
?>
</div>
<?php
if(!empty($all_photo_arr))
{
?>
<script>
/* ==== create imageFlow ==== */
// div ID, imagesbank, horizon, size, zoom, border, autoscroll_start, autoscroll_interval
imf.create("imageFlow", '<?php echo get_stylesheet_directory_uri(); ?>/imageFlowXML.php?gallery_id=<?php echo $gallery_id; ?>', 0.6, 0.4, 0, 0, 8, 4);
</script>
<?php
}
?>
<input type="hidden" id="pp_image_path" name="pp_image_path" value="<?php echo get_stylesheet_directory_uri(); ?>/images/"/>
<?php
$pp_enable_reflection = get_option('pp_enable_reflection');
?>
<input type="hidden" id="pp_enable_reflection" name="pp_enable_reflection" value="<?php echo $pp_enable_reflection; ?>"/>
<?php
$galleries = get_posts(array('parent' => -1, 'post_type' => 'gallery', 'numberposts' => -1));
$wp_galleries = array();
foreach ($galleries as $gallery_list ) {
$wp_galleries[$gallery_list->ID]['title'] = $gallery_list->post_title;
$wp_galleries[$gallery_list->ID]['desc'] = $gallery_list->post_content;
}
?>
<?php
if(isset($wp_galleries[$gallery_id]['title']))
{
?>
<div id="kenburns_title"><?php echo $wp_galleries[$gallery_id]['title']; ?></div>
<?php
}
if(isset($wp_galleries[$gallery_id]['desc']))
{
?>
<div id="kenburns_desc"><?php echo $wp_galleries[$gallery_id]['desc']; ?></div>
<?php
}
?>
<?php get_footer(); ?>