-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgif-page.php
executable file
·84 lines (75 loc) · 2.51 KB
/
gif-page.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
<?php
/**
* Template Name: Gif-page
* The template for gif page.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Minimal-Artistic-Portfolio
* @var Post $post the global WordPress post object
*/
$map_posts_per_page = get_option( 'posts_per_page' );
$map_gif_query_args = array(
'post_type' => 'gif',
'posts_per_page' => $map_posts_per_page,
'post_status' => 'publish',
'paged' => get_query_var( 'paged' ),
);
$map_post_content = '';
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
</article>
<?php $map_post_content = $post->post_content; ?>
<?php endwhile; // End of the loop. ?>
<?php $map_gif_query = new WP_Query( $map_gif_query_args ); ?>
<?php if ( $map_gif_query->have_posts() ) : ?>
<div class="entry-content">
<div class="gif-grid">
<?php while ( $map_gif_query->have_posts() ) : $map_gif_query->the_post(); ?>
<?php if ( get_the_post_thumbnail_url( $post, 'full' ) ) : ?>
<article id="post-<?php echo esc_attr( $post->ID ); ?>" class="animated-gif">
<a class="fluidbox"
href="<?php echo esc_url( get_the_post_thumbnail_url( $post, 'full' ) ); ?>"
data-fluidbox-loader>
<img
src="<?php echo esc_url( get_the_post_thumbnail_url( $post, 'medium' ) ); ?>"
title="<?php echo esc_html( $post->post_title ); ?>"
class="gif-thumbnail">
</a>
<div class="gif-source hidden">
<!-- preload our gif -->
<img src="<?php echo esc_url( get_the_post_thumbnail_url( $post, 'full' ) ); ?>">
</div>
</article>
<?php endif; ?>
<?php endwhile; ?>
</div><!-- .gif-grid -->
<?php if ( $map_gif_query->max_num_pages > 0 ) : ?>
<nav class="page-nav">
<?php
echo wp_kses_post(
paginate_links(
array(
'prev_next' => false,
'current' => max( 1, get_query_var( 'paged' ) ),
'total' => $map_gif_query->max_num_pages,
)
)
);
?>
</nav>
<?php endif; ?>
<p><?php echo wp_kses_post( $map_post_content ); ?></p>
</div><!-- .entry-content -->
<?php endif; ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_sidebar();
get_footer();