TMプリントのボディーで使用
フォーチ2回まわす。
その中でループ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | <?php ///宣言------------------------------------------ $args = array ( 'parent' => 0, 'hierarchical' => 0, 'orderby' => 'term_order' , // Category Order and Taxonomy Terms Order を使用 'order' => 'ASC' ); $taxonomy_name = 'body_cat' ; $taxonomys = get_terms( $taxonomy_name , $args ); if (!is_wp_error( $taxonomys ) && count ( $taxonomys )): foreach ( $taxonomys as $taxonomy_term ): ////フォーチ----------------------------?> <h3 class = "body_title2" style= "margin-bottom:30px;" ><?php echo $taxonomy_term ->name;?><span class = "d_price" ></span></h3> <?php $url = get_term_link( $taxonomy_term ->slug, $taxonomy_name ); $taxonomy_term_childrens = get_term_children( $taxonomy_term ->term_id, $taxonomy_name ); if (!is_wp_error( $taxonomy_term_childrens ) && count ( $taxonomy_term_childrens )): foreach ( $taxonomy_term_childrens as $taxonomy_term_children_id ): $taxonomy_term_children = get_term_by( 'id' , $taxonomy_term_children_id , $taxonomy_name ); //echo $taxonomy_term_children_id ?> <h4 class = "body_cat_child" > <?php echo $taxonomy_term_children ->name; ?> </h4> <div class = "body_box_all" > <?php $args = array ( 'posts_per_page' => -1, //'orderby' => 'menu_order', //'order' => 'ASC', 'tax_query' => array ( 'relation' => 'AND' , array ( 'taxonomy' => $taxonomy_name , 'field' => 'slug' , 'terms' => array ( $taxonomy_term_children ->slug ), //'operator'=>'NOT IN' ), ), //カテ例 'cat'=> 4, //カテ複数例 'cat'=> array(4,6) ); ?> <?php query_posts( $args ); ?> <?php if ( have_posts () ) : while ( have_posts() ) : the_post(); ?> <?php include ( "roop_body.php" ); ?> <?php endwhile ; endif ; ?> <?php wp_reset_query(); ?> </div> <!-----> <?php endforeach ; endif ; ?> <?php endforeach ; endif ; ?> |