Ticket #26937: 26937.11.patch
| File 26937.11.patch, 2.6 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/link-template.php
1293 1293 $query_args = array( 1294 1294 'posts_per_page' => 1, 1295 1295 'post_status' => 'publish', 1296 'post_type' => 'post',1296 'post_type' => $this->current_post->post_type, 1297 1297 'orderby' => 'date', 1298 1298 'order' => 'previous' === $this->adjacent ? 'DESC' : 'ASC', 1299 1299 'ignore_sticky_posts' => true, -
tests/phpunit/tests/link.php
175 175 // Need some sample posts to test adjacency 176 176 $post_one = $this->factory->post->create_and_get( array( 177 177 'post_title' => 'First', 178 'post_date' => '2012-01-01 12:00:00'178 'post_date' => '2012-01-01 12:00:00', 179 179 ) ); 180 180 181 181 $post_two = $this->factory->post->create_and_get( array( 182 182 'post_title' => 'Second', 183 'post_date' => '2012-02-01 12:00:00'183 'post_date' => '2012-02-01 12:00:00', 184 184 ) ); 185 185 186 186 $post_three = $this->factory->post->create_and_get( array( 187 187 'post_title' => 'Third', 188 'post_date' => '2012-03-01 12:00:00'188 'post_date' => '2012-03-01 12:00:00', 189 189 ) ); 190 190 191 191 $post_four = $this->factory->post->create_and_get( array( 192 192 'post_title' => 'Fourth', 193 'post_date' => '2012-04-01 12:00:00'193 'post_date' => '2012-04-01 12:00:00', 194 194 ) ); 195 195 196 // Use pages to test post-type adjacency 197 $page_one = $this->factory->post->create_and_get( array( 198 'post_title' => 'First Page', 199 'post_date' => '2013-01-01 12:00:00', 200 'post_type' => 'page', 201 ) ); 202 203 $page_two = $this->factory->post->create_and_get( array( 204 'post_title' => 'Second Page', 205 'post_date' => '2013-02-01 12:00:00', 206 'post_type' => 'page', 207 ) ); 208 196 209 // Add some meta so we can join the postmeta table and query 197 210 add_post_meta( $post_three->ID, 'unit_test_meta', 'waffle' ); 198 211 … … 233 246 $this->go_to( get_permalink( $post_one->ID ) ); 234 247 $this->assertEquals( $post_three, get_adjacent_post( false, null, false ) ); 235 248 remove_filter( 'get_next_post_sort', array( $this, 'filter_next_post_sort_limit' ) ); 249 250 // Test post-type specificity 251 $this->go_to( get_permalink( $page_one ) ); 252 $this->assertEquals( $page_two, get_adjacent_post( false, null, false ) ); 253 254 $this->go_to( get_permalink( $page_two ) ); 255 $this->assertEquals( $page_one, get_adjacent_post( false, null, true ) ); 236 256 } 237 257 238 258 /**
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)