-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtemplate-albums-jgrid.php
99 lines (67 loc) · 2.58 KB
/
template-albums-jgrid.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
<?php
/* Template Name: Albums - justified grid */
/**
* Media Albums template. Uses dt_gallery post type and dt_gallery_category taxonomy.
*
* @package The7
* @since 1.0.0
*/
// File Security Check.
if ( ! defined( 'ABSPATH' ) ) { exit; }
$config = presscore_config();
$config->set( 'template', 'albums' );
$config->set( 'template.layout.type', 'masonry' );
// Content controller.
add_action( 'presscore_before_main_container', 'presscore_page_content_controller', 15 );
get_header();
if ( presscore_is_content_visible() ): ?>
<!-- Content -->
<div id="content" class="content" role="main">
<?php
// Main loop.
if ( have_posts() ) : while ( have_posts() ) : the_post();
do_action( 'presscore_before_loop' );
if ( post_password_required() ) {
the_content();
} else {
// Backup config.
$config_backup = $config->get();
$page_query = presscore_get_filtered_posts( array( 'post_type' => 'dt_gallery', 'taxonomy' => 'dt_gallery_category' ) );
// Posts filter.
presscore_display_posts_filter( array(
'post_type' => 'dt_gallery',
'taxonomy' => 'dt_gallery_category',
'query' => $page_query
) );
// Fullwidth wrap open.
if ( $config->get( 'full_width' ) ) { echo '<div class="full-width-wrap">'; }
// Masonry container open.
echo '<div ' . presscore_masonry_container_class( array( 'wf-container', 'dt-albums-template' ) ) . presscore_masonry_container_data_atts() . '>';
// Custom query.
if ( $page_query->have_posts() ):
add_filter( 'presscore_get_images_gallery_hoovered-title_img_args', 'presscore_gallery_post_exclude_featured_image_from_gallery', 15, 3 );
while( $page_query->have_posts() ) {
$page_query->the_post();
presscore_populate_album_post_config();
presscore_get_template_part( 'mod_albums', 'album-masonry/album' );
}
wp_reset_postdata();
remove_filter( 'presscore_get_images_gallery_hoovered-title_img_args', 'presscore_gallery_post_exclude_featured_image_from_gallery', 15, 3 );
endif;
// Masonry container close.
echo '</div>';
// Fullwidth wrap close.
if ( $config->get( 'full_width' ) ) { echo '</div>'; }
// Pagination.
presscore_complex_pagination( $page_query );
// Restore config.
$config->reset( $config_backup );
}
do_action( 'presscore_after_loop' );
// Main loop end.
endwhile; endif; ?>
</div><!-- #content -->
<?php do_action('presscore_after_content');
// If content visible end.
endif;
get_footer(); ?>