Changeset 7118 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/functions.php
- Timestamp:
- 04/17/2018 07:38:47 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/functions.php
r6323 r7118 141 141 add_action( 'wp_enqueue_scripts', 'gutenbergtheme_scripts' ); 142 142 143 function gutenbergtheme_adjacent_post_order( $order_by, $post, $order ) { 144 if ( 'handbook' !== $post->post_type ) { 145 return $order_by; 146 } 147 148 return "ORDER BY p.menu_order $order LIMIT 1"; 149 } 150 add_filter( 'get_previous_post_sort', 'gutenbergtheme_adjacent_post_order', 10, 3 ); 151 add_filter( 'get_next_post_sort', 'gutenbergtheme_adjacent_post_order', 10, 3 ); 152 153 function gutenbergtheme_previous_post_where( $where, $in_same_term, $excluded_term, $taxonomy, $post ) { 154 if ( 'handbook' !== $post->post_type ) { 155 return $order_by; 156 } 157 158 return "WHERE p.post_type='handbook' AND p.post_status='publish' AND p.menu_order < {$post->menu_order}"; 159 } 160 add_filter( 'get_previous_post_where', 'gutenbergtheme_previous_post_where', 10, 5 ); 161 162 function gutenbergtheme_next_post_where( $where, $in_same_term, $excluded_term, $taxonomy, $post ) { 163 if ( 'handbook' !== $post->post_type ) { 164 return $order_by; 165 } 166 167 return "WHERE p.post_type='handbook' AND p.post_status='publish' AND p.menu_order > {$post->menu_order}"; 168 } 169 add_filter( 'get_next_post_where', 'gutenbergtheme_next_post_where', 10, 5 ); 170 143 171 /** 144 172 * Implement the Custom Header feature.
Note: See TracChangeset
for help on using the changeset viewer.