Пример #1
0
 function testGetPostsAsPageOld()
 {
     $term_id = $this->factory->term->create();
     $posts = array();
     $posts[] = $this->factory->post->create();
     $posts[] = $this->factory->post->create();
     $posts[] = $this->factory->post->create();
     foreach ($posts as $post_id) {
         set_post_type($post_id, 'page');
         wp_set_object_terms($post_id, $term_id, 'post_tag', true);
     }
     $term = new TimberTerm($term_id);
     $gotten_posts = $term->posts(count($posts), 'page');
     $this->assertEquals(count($posts), count($gotten_posts));
     $gotten_posts = $term->posts(count($posts), 'any');
     $this->assertEquals(count($posts), count($gotten_posts));
     $gotten_posts = $term->posts(count($posts), 'post');
     $this->assertEquals(0, count($gotten_posts));
 }
Пример #2
0
 public function posts($numberposts_or_args = 10, $post_type_or_class = 'any', $post_class = '')
 {
     return $this->term->posts($numberposts_or_args, $post_type_or_class, $post_class);
 }