-
Notifications
You must be signed in to change notification settings - Fork 0
/
slider.php
107 lines (94 loc) · 3.34 KB
/
slider.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
<?php
/*
===================================================================================================
WARNING! DO NOT EDIT THIS FILE OR ANY TEMPLATE FILES IN THIS THEME!
To make it easy to update your theme, you should not edit this file. Instead, you should create a
Child Theme first. This will ensure your template changes are not lost when updating the theme.
You can learn more about creating Child Themes here: http://codex.wordpress.org/Child_Themes
You have been warned! :)
===================================================================================================
*/
?>
<?php
$slide_settings = get_option('ct_slide_settings');
isset($slide_settings['orderby']) ? $orderby = $slide_settings['orderby'] : $orderby = null;
isset($slide_settings['order']) ? $order = $slide_settings['order'] : $order = null;
isset($slide_settings['active_slide_tags']) ? $tags = $slide_settings['active_slide_tags'] : $tags = null;
isset($slide_settings['slide_limit']) ? $num = $slide_settings['slide_limit'] : $num = null;
if(empty($orderby)) $orderby = 'date';
if(empty($order)) $order = 'DESC';
global $post;
if($orderby == 'views'):
$args=array(
'post_type' => 'ct_slide',
'post_status' => 'publish',
'posts_per_page' => $num,
'meta_key' => 'Views',
'orderby' => 'meta_value_num',
'order' => $order,
'slide_tag' => $tags,
);
else:
$args=array(
'post_type' => 'ct_slide',
'post_status' => 'publish',
'posts_per_page' => $num,
'orderby' => $orderby,
'order' => $order,
'slide_tag' => $tags,
);
endif;
$query = null;
$query = new WP_Query($args);
?>
<div id="ribbon" class="home">
<div class="container_12 grid-container">
<div class="grid_12 grid-100">
<div class="slide_frame<?php if($query->have_posts()): else: echo ' empty'; endif; ?>">
<div id="slider">
<div class="slide_holder">
<div class="mask">
<ul>
<?php
if($query->have_posts()): while($query->have_posts()) : $query->the_post();
$sl_tagline = get_post_meta($post->ID, '_ct_sl_tagline', true);
$sl_linkurl = get_post_meta($post->ID, '_ct_sl_linkurl', true);
$sl_disable_text = get_post_meta($post->ID, '_ct_sl_disable_text', true);
$img_attr = array(
'alt' => trim(strip_tags($post->post_title)),
'title' => '',
);
?>
<li>
<div class="slide">
<?php if($sl_linkurl): ?><a href="<?php echo $sl_linkurl; ?>"><?php endif; ?>
<?php echo get_the_post_thumbnail($post->ID, 'slide', $img_attr); ?>
<?php if($sl_linkurl): ?></a><?php endif; ?>
<?php if($sl_disable_text != 'true'): ?>
<div class="slide_content_holder">
<div class="slide_content">
<?php if($sl_linkurl): ?><a href="<?php echo $sl_linkurl; ?>"><?php endif; ?>
<h2 class="title"><span><?php the_title(); ?></span></h2>
<?php if($sl_linkurl): ?></a><?php endif; ?>
<?php if($sl_tagline): ?>
<?php if($sl_linkurl): ?><a href="<?php echo $sl_linkurl; ?>"><?php endif; ?>
<h3 class="subtitle"><span><?php echo $sl_tagline; ?></span></h3>
<?php if($sl_linkurl): ?></a><?php endif; ?>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
</div>
</li>
<?php endwhile; endif; wp_reset_query(); ?>
</ul>
</div>
</div>
<div class="pag_box hide-on-mobile">
<div class="pag_frame"></div>
</div>
</div>
</div>
</div>
</div>
</div>