Support » Plugin: Custom Taxonomy Order » not working with my Custom query

  • hello, i have a query to get all categories then display all posts in each term
    the plugin was working 100% before i create Parent/Child categories.

    could you help me where i should put this code ? ‘orderby’ => ‘term_order’, ‘order’ => ‘ASC’

    <?php
    
    	//show duplicates
    $do_not_duplicate = array(
    
    );
    //get all categories then display all posts in each term
    $taxonomy = 'category';
    $param_type = 'category__in';
    $term_args=array(
    
    );
    $terms = get_terms($taxonomy,$term_args);
    if ($terms) {
            $counter = 1;
    		$total_invitations=0;
    		$total_invitees=0;
    		
      foreach( $terms as $term ) {
        $args=array(
          'post__not_in'     => $do_not_duplicate,
          'connected_type' => 'post_to_event',
          'connected_items' => get_queried_object(),
          "$param_type" => array($term->term_id),
          'nopaging' => true,
          'post_type' => 'post',
          'post_status' => 'publish,draft',
          'posts_per_page' => -1,
          'caller_get_posts'=> 1
          );
        $my_query = null;
        $my_query = new WP_Query($args);
    	
        if( $my_query->have_posts() ) {
    	$cat_invitations=$my_query->found_posts;
    	$cat_invitees=0;
    	$do_not_duplicate[] = get_the_ID();	
    	?>
    <h1><?php echo $term->name;?></h1>
       
    		    <?php
         if( $my_query->have_posts() ) {
    
        while ($my_query->have_posts()) : 
    	$my_query->the_post();
    
            $post_id = get_the_ID();
    
            if (in_array($post_id, $do_not_duplicate)) {
                continue; // We've already seen this post ID, so skip the rest of the loop
            }
    
    	  if (p2p_get_meta(get_post()->p2p_id, 'couples', true) == '1') $cat_invitees+= 2;
    	  else $cat_invitees++;
    
            $do_not_duplicate[] = $post_id;
    
            ?>
    
          <?php include (TEMPLATEPATH . '/contactfullname.php'); ?> - <?php echo get_post_meta($post->ID, 'ecpt_position', true); ?>
    
    	  <?php $counter++; ?>
           <?php
          endwhile;
    	  $total_invitees+=$cat_invitees;
    	  $total_invitations+=$cat_invitations;
          } ?>
    	  
    <?php echo $cat_invitations ;?>
    			<?php echo $cat_invitees ;?>
    <?php
        }
      }
      
     } wp_reset_query();  // Restore global post data stomped by the_post(). ?>	
    
     Number of invitations: <?php echo $total_invitations; ?>
     Number of Invitiess<?php echo $total_invitees; ?>
Viewing 1 replies (of 1 total)
  • Plugin Author Marcel Pol

    (@mpol)

    Hi, this code does work for me in standard categories.
    I don’t use the Types or Post 2 Posts plugin.
    You are sure you selected the right option for term-order in categories? It should be set to custom order.

    You shouldn’t need to add any parameter to get_terms(), it should just order them automatically.

    What happens when you disable other plugins? Are there other plugins that add a term_order parameter to get_terms $args?

Viewing 1 replies (of 1 total)
  • The topic ‘not working with my Custom query’ is closed to new replies.