开发者

Getting wp_list_categories() custom walker to paginate

I've got a custom post type registered, with custom taxonomies, everything good and clear.

I wish I could somehow display all the categories of the taxonomy with pagination.

I am using a custom category Walker and am thinking to register a custom page rewrite for page query, and add some code to the categ开发者_Go百科ory walker to display only the desired interval. Am I on the right direction?

Also, wp_list_categories sends to the category Walker the entire list of categories. Is there any way to get only the desired interval?


In this particular setup, no.

But I found a workaround: I registered a function that created a custom-type post each time I added a category in the taxonomy. That way I used the archive feature for custom post types, made available in 3.1-RC1.

function create_crew_post_on_term($term_id) {

$term = get_term($term_id, 'crew');

$post = array(
      'comment_status' => 'open',
      'ping_status' => 'open',
      'post_author' => 1,
      'post_content' => '',
      'post_date' => date('Y-m-d H:i:s'),
      'post_excerpt' => '',
      'post_name' => $term->slug,
      'post_status' => 'publish',
      'post_title' => $term->name,
      'post_type' => 'crew'
    );  

    wp_insert_post( $post );


}
add_action('created_crew', 'create_crew_post_on_term');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜