File tree 3 files changed +75
-1
lines changed
3 files changed +75
-1
lines changed Original file line number Diff line number Diff line change @@ -10,3 +10,35 @@ function is_subpage() {
10
10
return false ; // ... the answer to the question is false
11
11
}
12
12
}
13
+
14
+ if ( version_compare ( $ wp_version , '3.5-alpha ' , '< ' ) ) :
15
+ add_filter ( 'posts_where_paged ' , function ( $ where , $ query ) {
16
+ global $ wpdb ;
17
+ if ( $ menu_order = absint ( $ query ->get ( 'menu_order ' ) ) )
18
+ $ where .= " AND $ wpdb ->posts .menu_order = " . $ menu_order ;
19
+ return $ where ;
20
+ }, 10 , 2 );
21
+ endif ;
22
+
23
+ function get_next_prev_post () {
24
+ global $ post ;
25
+ $ menu_order_prev = $ post ->menu_order - 1 ;
26
+ $ menu_order_next = $ post ->menu_order + 1 ;
27
+
28
+ $ posts_prev = new WP_Query ( array (
29
+ 'post_type ' => 'page ' ,
30
+ 'post_status ' => 'publish ' ,
31
+ 'menu_order ' => $ menu_order_prev
32
+ ) );
33
+
34
+ $ posts_next = new WP_Query ( array (
35
+ 'post_type ' => 'page ' ,
36
+ 'post_status ' => 'publish ' ,
37
+ 'menu_order ' => $ menu_order_next
38
+ ) );
39
+
40
+ return array (
41
+ 'prev ' => count ($ posts_prev ->posts ) ? $ posts_prev ->posts [0 ] : NULL ,
42
+ 'next ' => count ($ posts_next ->posts ) ? $ posts_next ->posts [0 ] : NULL
43
+ );
44
+ }
Original file line number Diff line number Diff line change 1
1
<?php get_header (); ?>
2
-
2
+ <?php $ next_prev_arr = get_next_prev_post (); ?>
3
+
3
4
<!-- body -->
4
5
<?php global $ sidebar ; ?>
5
6
<div id="body" class="clearfix <?php echo $ sidebar ; ?> ">
14
15
<h2>Suggestions, Problems, Feedback</h2>
15
16
<a class="btn" href="<?php echo jq_get_github_url (); ?> "><i class="icon-github"></i> Open an Issue or Submit a Pull Request on GitHub</a>
16
17
18
+
19
+ <div class='bottom-links'>
20
+ <?php if (isset ($ next_prev_arr ['prev ' ])): ?>
21
+ <div class='prev'>
22
+ <a href="<?php echo $ next_prev_arr ['prev ' ]->guid ; ?> ">
23
+ <i class="icon-chevron-left"></i>
24
+ <?php echo $ next_prev_arr ['prev ' ]->post_title ; ?>
25
+ </a>
26
+ </div>
27
+ <?php endif ; ?>
28
+ <?php if (isset ($ next_prev_arr ['next ' ])): ?>
29
+ <div class='next'>
30
+ <a href="<?php echo $ next_prev_arr ['next ' ]->guid ; ?> ">
31
+ <?php echo $ next_prev_arr ['next ' ]->post_title ; ?>
32
+ <i class="icon-chevron-right"></i>
33
+ </a>
34
+ </div>
35
+ <?php endif ; ?>
36
+ </div>
17
37
</div>
18
38
<!-- /inner -->
19
39
Original file line number Diff line number Diff line change @@ -63,3 +63,25 @@ Template: jquery
63
63
# body .inner .icon-github {
64
64
color : # 30b9f8 ;
65
65
}
66
+ # body .inner .bottom-links {
67
+ background : lightGray;
68
+ overflow : auto;
69
+ padding : 0px 20px ;
70
+ clear : left;
71
+ }
72
+ # body .inner .bottom-links i {
73
+ }
74
+ # body .inner .bottom-links a {
75
+ text-decoration : none;
76
+ }
77
+ # body .inner .bottom-links .prev , # body .inner .bottom-links .next {
78
+ color : gray;
79
+ font-size : 1.5em ;
80
+ line-height : 2em ;
81
+ }
82
+ # body .inner .bottom-links .prev {
83
+ float : left;
84
+ }
85
+ # body .inner .bottom-links .next {
86
+ float : right;
87
+ }
You can’t perform that action at this time.
0 commit comments