-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforums-pagination.php
More file actions
115 lines (100 loc) · 2.89 KB
/
Copy pathforums-pagination.php
File metadata and controls
115 lines (100 loc) · 2.89 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
<?php
global $tax_query;
/**
* Total number of published posts in the database that are viewable by everyone
*
* @var int
**/
$posts_count = $tax_query ? (int) $tax_query->found_posts : (int) $wp_query->found_posts;
/**
* Maximum number of posts in a listing page
*
* @var int
**/
$posts_per_page = (int) get_query_var( 'posts_per_page' );
/**
* Number of pages required to display all the posts
*
* @var int
**/
$pages_of_posts = (int) ceil( $posts_count / $posts_per_page );
/**
* Current page of posts
*
* @var int
**/
$paged = (int) ( get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1 );
?>
<footer class="threads-pagination">
<ul class="c">
<?php if ( $paged !== 1 ): ?>
<li class="threads-pagination-li threads-pagination-newest">
<a href="<?php echo get_term_link( get_queried_object() ); ?>">
1
</a>
</li>
<?php else: ?>
<li class="threads-pagination-li threads-pagination-empty">
0
</li>
<?php endif; ?>
<?php if ( ( $newer = $paged - 2 ) > 1 ): ?>
<li class="threads-pagination-li threads-pagination-newer-2">
<a href="<?php echo get_term_link( get_queried_object() ) . 'page/' . $newer . '/'; ?>">
<?php echo $newer; ?>
</a>
</li>
<?php else: ?>
<li class="threads-pagination-li threads-pagination-empty">
0
</li>
<?php endif; ?>
<?php if ( ( $newer = $paged - 1 ) > 1 ): ?>
<li class="threads-pagination-li threads-pagination-newer">
<a href="<?php echo get_term_link( get_queried_object() ) . 'page/' . $newer . '/'; ?>">
<?php echo $newer; ?>
</a>
</li>
<?php else: ?>
<li class="threads-pagination-li threads-pagination-empty">
0
</li>
<?php endif; ?>
<li class="threads-pagination-li threads-pagination-current">
<?php echo $paged; ?>
</li>
<?php if ( ( $older = $paged + 1 ) < $pages_of_posts ): ?>
<li class="threads-pagination-li threads-pagination-older">
<a href="<?php echo get_term_link( get_queried_object() ) . 'page/' . $older . '/'; ?>">
<?php echo $older; ?>
</a>
</li>
<?php else: ?>
<li class="threads-pagination-li threads-pagination-empty">
0
</li>
<?php endif; ?>
<?php if ( ( $older = $paged + 2 ) < $pages_of_posts ): ?>
<li class="threads-pagination-li threads-pagination-older-2">
<a href="<?php echo get_term_link( get_queried_object() ) . 'page/' . $older . '/'; ?>">
<?php echo $older; ?>
</a>
</li>
<?php else: ?>
<li class="threads-pagination-li threads-pagination-empty">
0
</li>
<?php endif; ?>
<?php if ( $paged !== $pages_of_posts ): ?>
<li class="threads-pagination-li threads-pagination-oldest">
<a href="<?php echo get_term_link( get_queried_object() ) . 'page/' . $pages_of_posts . '/'; ?>">
<?php echo $pages_of_posts; ?>
</a>
</li>
<?php else: ?>
<li class="threads-pagination-li threads-pagination-empty">
0
</li>
<?php endif; ?>
</ul>
</footer>