-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathslideshow.php
131 lines (80 loc) · 2.9 KB
/
slideshow.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
125
126
127
128
129
130
131
<?php
/**
* This file is part of the WordPress theme Chamada Publica.
*
* Chamada Publica 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
* any later version.
*
* Chamada Publica 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 Chamada Publica. If not, see <http://www.gnu.org/licenses/>.
*
*/
?>
<div class="slideshow">
<div class="slideshow-container">
<?php
$video_id = get_post_meta($post->ID, 'video_id', TRUE);
$video_srv = get_post_meta($post->ID, 'video_srv', TRUE);
if($video_id) {
if($video_srv == 'Vimeo') {
$video_url = "http://player.vimeo.com/video/$video_id?title=0&byline=0&portrait=0";
} elseif ($video_srv == 'YouTube') {
$video_url = "http://www.youtube.com/embed/rjFaenf1T-Y?rel=0&wmode=opaque";
}
}
$attachment_args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID,
'orderby' => 'menu_order ID',
'order' => 'ASC'
);
$attachments = get_posts($attachment_args);
if($attachments) { ?>
<?php if(count($attachments) > 1) { ?>
<?php if($post->post_name == 'patrocine_bkp') { ?>
<div class="apresentacao">
<?php echo wp_get_attachment_image($attachments[0]->ID, 'slideshow-thumb'); ?>
<?php foreach($attachments as $attachment) { ?>
<?php if($attachment == $attachments[0]) { ?>
<div class="capa">
<a href="<?php echo wp_get_attachment_url($attachment->ID); ?>" rel="shadowbox[patrocine]">Veja nossa apresentação</a>
</div>
<?php } else { ?>
<a href="<?php echo wp_get_attachment_url($attachment->ID); ?>" rel="shadowbox[patrocine]" <?php echo $class; ?>><?php echo $text; ?></a>
<?php } ?>
<?php } ?>
</div>
<?php } else { ?>
<div class="prev">Anterior</div>
<div class="next">Próxima</div>
<div class="carousel">
<ul>
<?php if($video_id) { ?>
<li><iframe src="<?php echo $video_url; ?>" frameborder="0"></iframe></li>
<?php } ?>
<?php foreach($attachments as $attachment) { ?>
<li><?php echo wp_get_attachment_image($attachment->ID, 'slideshow-thumb'); ?></li>
<?php } ?>
</ul>
</div>
<?php } ?>
<?php } else { ?>
<?php $attachment = array_shift($attachments); ?>
<?php echo wp_get_attachment_image($attachment->ID, 'slideshow-thumb'); ?>
<?php } ?>
<?php } else { ?>
<?php if($video_id) { ?>
<iframe src="<?php echo $video_url; ?>" frameborder="0"></iframe>
<?php } ?>
<?php } ?>
</div>
</div>