• いつもお世話になっております。

    http://naoyu.net/wordpress/tax_query/583/
    こちらのページを参考に、
    以下のソースを反映したのですが、
    1pに1商品が6個づつ出る状態になっており、
    ページネーションすると
    2番目の商品が同じく6個ずつならんだ状態になっております。
    (ようするに、1商品ずつ1pごとに割り振られている状態でございます。)
    どこかのループがうまく回っていないのか。。
    お分かりになる方いらっしゃいましたらご教授ください。
    何卒よろしくお願いいたします。

    <?php
    				$args = array(
    				'parent'       => 0,
    				'hierarchical' => 0,
    				'orderby'      => 'slug',
    				'order'        => 'ASC'
    				);
    				    $taxonomy_name = 'chukai_cat';
    				    $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' => 6, // 表示させたい記事数
    				            'tax_query' => array(
    				                array(
    				                    'taxonomy'=>'chukai_cat',
    				                    'terms'=>array( $taxonomy->slug ),
    				                    'field'=>'slug',
    				                    'include_children'=>false,
    				                    'operator'=>'IN'
    				                    ),
    				                'relation' => 'AND'
    				                )
    				            ));
    				    if($tax_posts):
    				?>
    				<h2 id="<?php echo esc_html($taxonomy->slug); ?>" class="h_style_bluebar"><?php echo esc_html($taxonomy->name); ?></h2>
    				<ul class="row">
    
    					<?php foreach($tax_posts as $tax_post): ?>
    
    					<li class="col mgn m4 s6 house_list mgn_b3 js-matchHeight">
    						<ul class="house_list_block">
    							<li class="house_list_img mgn_b1"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a></li>
    							<li class="house_list_icons mgn_b05">
    								<?php
    								$days = 7; //Newを表示させたい期間の日数
    								$today = date_i18n('U');
    								$entry = get_the_time('U');
    								$kiji = date('U',($today - $entry)) / 86400 ;
    								if( $days > $kiji ){
    								echo '<img src="' . get_template_directory_uri() . '/images/ico_new.png' . ' " alt="new" class="ico_new_rt" />';
    								}
    								?>
    
    								<?php
    								if ($terms = get_the_terms($post->ID, 'chukai_cat')) {
    									foreach ( $terms as $term ) {
    										echo '<span class="ico_base">' . esc_html($term->name) . '</span>';
    									}
    								}
    								?>
    							</li>
    							<li class="house_list_txt">
    								<a href="<?php the_permalink(); ?>">
    								<span class="house_list_txt_child"><?php echo post_custom("housedata_adress01"); ?></span>
    								<span class="house_list_txt_child">
    									<?php if(get_post_meta($post->ID,'housedata_adress02',true)): ?>
    										<?php echo '<span class="pdg_r05">' . post_custom("housedata_adress02") . '</span>'; ?>
    									<?php endif; ?>
    									<?php if(get_post_meta($post->ID,'housedata_adress03',true)): ?>
    										<?php echo '<span class="pdg_r05">' . post_custom("housedata_adress03") . '</span>'; ?>
    									<?php endif; ?>
    									<?php if(get_post_meta($post->ID,'housedata_adress04',true)): ?>
    										<?php echo '<span class="pdg_r05">' . post_custom("housedata_adress04") . '</span>'; ?>
    									<?php endif; ?>
    								</span>
    								<span class="house_list_txt_child"><?php echo number_format(get_post_meta($post->ID,'housedata_price',true));?>万円</span></a>
    							</li>
    						</ul>
    					</li>
    				    <?php endforeach; ?>
    				</ul>
    				<?php
    				        endif;
    				endforeach;
    				endif;
    				?>
  • トピック「カスタム投稿記事でタームごとに一覧表示したい」には新たに返信することはできません。