This repository was archived by the owner on May 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcontent-template-portfolio-slider.php
More file actions
137 lines (113 loc) · 3.06 KB
/
content-template-portfolio-slider.php
File metadata and controls
137 lines (113 loc) · 3.06 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
135
136
137
<?php
/**
* The content for the fullscreen slider portfolio template.
*
* @package Bricks
* @link https://themebeans.com/themes/bricks
*/
// PULL PAGINATION FROM CUSTOMIZATION
$portfolio_posts_count = get_theme_mod( 'portfolio_posts_count' );
// PULL PAGINATION FROM READING SETTINGS
$paged = 1;
if ( get_query_var( 'paged' ) ) {
$paged = get_query_var( 'paged' );
}
if ( get_query_var( 'page' ) ) {
$paged = get_query_var( 'page' );
}
// GET THE LOOP ORDERBY & META_KAY VARIABLES VIA THEME CUSTOMIZER
$orderby = get_theme_mod( 'portfolio_loop_orderby' );
// LOOP ORDERBY VARIABLE
if ( $orderby != '' ) {
switch ( $orderby ) {
case 'date':
$order = 'DSC';
$orderby = 'date';
$meta_key = '';
break;
case 'rand':
$order = 'DSC';
$orderby = 'rand';
$meta_key = '';
break;
case 'menu_order':
$order = 'ASC';
$orderby = 'menu_order';
$meta_key = '';
break;
case 'view_count':
$order = 'DSC';
$orderby = 'meta_value_num';
$meta_key = 'post_views_count';
break;
}
}
?>
<div id="slider-<?php echo esc_attr( $post->ID ); ?>" class="home-slider">
<script type="text/javascript">
jQuery(document).ready(function($){
$('#slider-<?php echo esc_js( $post->ID ); ?>').superslides({
animation: 'slide',
pagination: true,
play: 3000,
});
$('#slider-<?php echo esc_js( $post->ID ); ?>').on('animated.slides', function () {
BackgroundCheck.refresh();
});
});
</script>
<ul class="slides-container">
<?php
$args = array(
'post_type' => 'portfolio',
'order' => $order,
'orderby' => $orderby,
'paged' => $paged,
'meta_key' => $meta_key,
'posts_per_page' => '15',
'ignore_sticky_posts' => true,
);
$wp_query = new WP_Query( $args );
?>
<?php
if ( $wp_query->have_posts() ) :
while ( $wp_query->have_posts() ) :
$wp_query->the_post();
?>
<li>
<?php the_post_thumbnail( 'port-full' ); ?>
<?php if ( get_theme_mod( 'slide_template_title' ) == true ) { ?>
<div class="overlay fadein">
<a title="<?php printf( __( 'Permanent Link to %s', 'bricks' ), get_the_title() ); ?>" href="<?php the_permalink(); ?>">
<h1><?php the_title(); ?></h1>
</a>
</div>
<?php } //END slide_template_title ?>
</li>
<?php
endwhile;
endif;
?>
</ul><!-- END .slides-container -->
</div><!-- END .home-slider -->
<ul class="home-slider home-slider-mobile fadein">
<?php
if ( $wp_query->have_posts() ) :
while ( $wp_query->have_posts() ) :
$wp_query->the_post();
?>
<li>
<a title="<?php printf( __( 'Permanent Link to %s', 'bricks' ), get_the_title() ); ?>" href="<?php the_permalink(); ?>">
<?php the_post_thumbnail( 'port-full' ); ?>
<?php if ( get_theme_mod( 'slide_template_title' ) == true ) { ?>
<div class="overlay">
<h1><?php the_title(); ?></h1>
</div>
<?php } //END slide_template_title ?>
</a>
</li>
<?php
endwhile;
endif;
?>
</ul><!-- END .home-slider-mobile -->