-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathnavigation.php
More file actions
65 lines (53 loc) · 1.54 KB
/
navigation.php
File metadata and controls
65 lines (53 loc) · 1.54 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
<?php
/**
* The template part for displaying navigation.
*
* @package ColorMag
*
* @since ColorMag 1.0.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Navigation for archive, home and search results pages.
*/
if ( is_archive() || is_home() || is_search() ) :
/**
* Display WP-PageNavi pagination instead of theme pagination if the plugin exists.
*/
if ( function_exists( 'wp_pagenavi' ) ) :
wp_pagenavi();
else :
global $wp_query;
if ( $wp_query->max_num_pages > 1 ) :
?>
<ul class="default-wp-page">
<li class="previous"><?php next_posts_link( esc_html__( '← Previous', 'colormag' ) ); ?></li>
<li class="next"><?php previous_posts_link( esc_html__( 'Next →', 'colormag' ) ); ?></li>
</ul>
<?php
endif;
endif;
endif;
/**
* Navigation for single post page.
*/
if ( is_single() ) :
if ( is_attachment() ) :
?>
<ul class="default-wp-page">
<li class="previous"><?php previous_image_link( false, esc_html__( '← Previous', 'colormag' ) ); ?></li>
<li class="next"><?php next_image_link( false, esc_html__( 'Next →', 'colormag' ) ); ?></li>
</ul>
<?php
else :
?>
<ul class="default-wp-page">
<li class="previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . colormag_get_icon( 'arrow-left-long', false ) . '</span> %title' ); ?></li>
<li class="next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . colormag_get_icon( 'arrow-right-long', false ) . '</span>' ); ?></li>
</ul>
<?php
endif;
endif;