yad4u Add & Separate Custom Post Types in Taxonomy.php / Taxonomy Page
صفحه اصلي

Add & Separate Custom Post Types in Taxonomy.php / Taxonomy Page

I have a taxonomy.php file to display taxonomy terms. I added a filter in functions.php to include post types for the taxonomy page query. This filter:

   add_filter( 'pre_get_posts' , 'ucc_include_custom_post_types' ); function ucc_include_custom_post_types( $query ) {   global $wp_query;    /* Don't break admin or preview pages. */   if ( !is_preview() && !is_admin() && !is_page() && !is_single() ) {     $args = array(       'public' => true ,       '_builtin' => false     );     $output = 'names';     $operator = 'and';      $post_types = get_post_types( $args , $output , $operator );     $post_types = array_merge( $post_types , array( 'post' ) );      if ($query->is_feed) {       // Do feed processing here.     } else {       $my_post_type = get_query_var( 'post_type' );       if ( empty( $my_post_type ) )         $query->set( 'post_type' , $post_types );     }   }    return $query; } 

Returns any and all post types you want. But I am trying to find a way to separate them. I tried to use a normal loop but I don't know how to fetch the current taxonomy tag from the page.

I have 2 questions which are all related but seeing what is the best way to go about this. Pretend I have 3 posts types ('post' 'post2' 'post3')

  1. Is there a loop that can be used in taxonomy.php that will display a particular post type? So it can be possible to have one loop for each post type? So when I click on a taxonomy term, the taxonomy.php will return:

--Taxonomy Page --

Loop for custom type post 1 (show post with current taxonomy tag in this specific post type)

Loop for custom type post 2

Loop for custom type post 3

  1. If there are multiple loops, will this affect the pagination? Or will pagination only work for posts?

I have used many single loops in the taxonomy.php page to no avail. I feel I have to echo the current taxonomy term variable to a new variable:

$term = $wp_taxonomies??

Any way for multiple loops in the taxonomy.php pages?

Wordpress popularity contest to only track posts from a specific category


OpenSource alternatives on XCloner [closed]
Probably the easiest way to did this is ignore the existing $wp_query and create three new queries in your taxonomy template. What is the difference between developing a Drupal module and a WordPress plugin?So don't start "The Loop" in your template, just create a new query and loop with this one. How do I call functions from my Plugin in WP template?Repeat this for the another post types. wordpress extended_valid_elements for script tag?This also means you don't need to hook into the pre_receive _posts filter, you create a custom query just for you.. Plugin Suggestions - Wordpress as a Membership Directory You will have to think around the UI for the next pages, indeed. How to query posts for a custom post type in a custom taxonomy ? in wordpress 3.0This depends on the reason you want the post types separated. Why my wordpress plugin settings shows up for users other than administrator?If it is enough this you see the three toreceive her on the first page, you could go with three separate "next page" links, so one per post type..

98 out of 100 based on 53 user ratings 608 reviews