Help us understand the problem. What is going on with this article?

【覚書】カスタム投稿タイプ:タームごとの記事一覧をひとつのページに

More than 3 years have passed since last update.
archive-xxx.php
<div class="wrapper">


<?php
 $args = array(
   'parent' => 0,
   'hierarhical' => 0,
   'orderby' => 'id',
   'order' =>'ASC'
  );
  $taxonomy_name = 'makerscat';
  $taxonomys = get_terms($taxonomy_name,$args);
  if(!is_wp_error($taxonomys) && count($taxonomys)):
        foreach($taxonomys as $taxonomy):
        $url = get_term_link($taxonomy->slug, $taxonomy_name);
        $tax_posts = get_posts(array(
          'post_type' => get_post_type(),
          'posts_per_page' => 5,
          'tax_query' => array(
            array(
              'taxonomy' => 'makerscat',
              'terms' => array($taxonomy->slug),
              'field' =>'slug',
              'include_children' => true,
              'operator' => 'IN'
            ),
            'relation' =>'AND'
          )
        ));
        if($tax_posts):
?>

<h3 class="mincho"><?php echo($taxonomy->name); ?></h3>

<div class="fx-row fx-row-around-xs">

<?php foreach($tax_posts as $tax_post): setup_postdata($tax_post); ?>
  <div class="fx-col-30-s fx-col-90-xs makerDiv">
        <h4><?php if(has_post_thumbnail($tax_post->ID)) {
                echo get_the_post_thumbnail($tax_post->ID,'post-thumbnail');
             } ?></h4>
        <!-- /.fx-row fx-row-around-xs -->
        <h5><?php echo get_the_title($tax_post->ID); ?></h5>
<?php the_content(); ?>

    </div>
<?php endforeach; ?>


</div>

<?php endif;
 endforeach;
 endif; ?>



</div>
<!-- /.wrapper -->

この一行超大事

<?php foreach($tax_posts as $tax_post): setup_postdata($tax_post); ?>

http://naoyu.net/wordpress/tax_query/583/
http://wpcos.com/?p=7846

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした