1

我想在我的页面中获得一个寻呼机,我可以创建一个带有 for each 或 while 的寻呼机,而无需像“posts_per_page”这样的参数吗?

我得到了我的分类学的术语孩子,我想显示 3 by 3

我的代码:

      $childGalerie = get_term_children(15,'wpmf-category');

      foreach ( $childGalerie as $oneGalerie ) : 
       $maGalerie = get_term($oneGalerie, 'wpmf-category');

       ?>
       <h2 class="info-galerie"><span></span><?php echo $maGalerie->name;  > </h2>
       <div class="galerie-photo">
           <?php
           global $post;
           $args = array(
               'posts_per_page'   => -1,
               'post_type'        => 'attachment',
               //                    'post_status'      => 'inherit',
               'tax_query' => array(
                   array(
                       'taxonomy' => 'wpmf-category',
                       'field' => 'term_id',
                       'terms' => $oneGalerie
                   ),
               ),
           );
           $media = get_posts( $args );
           foreach ( $media as $post ) : setup_postdata( $post ); 
           ?>
           <div class="wrapper-galerie">
               <?php echo wp_get_attachment_image( $media->ID, 'galerie->photo' ); ?>
           </div>
           <?php
           endforeach; 
           wp_reset_postdata();

           ?>
       </div>
       <?php
       endforeach; 

你能帮我吗,ty :D

4

0 回答 0