$term_post_type = 'recipe';
$term_taxonomy = 'recipe_tag';
?>
</div> </div><?php $recipe_months = array( 'posts_per_page' => 0, 'post_type' => $term_post_type, 'taxonomy' => $term_taxonomy, 'term' => $term_title, ); $recipe_months = get_posts( $recipe_months ); ?> <?php if ($recipe_months) : ?> <?php foreach ( $recipe_months as $post_months ) : setup_postdata( $post_months ); ?> <?php //var_dump($post_months->ID);?> <?php //echo $post_months->ID;?> <?php $post_months_id = $post_months->ID;?> <div class="item"> <?php set_query_var( 'postid', $post_months->ID); ?> <figure> <a href="<?php the_permalink($post_months_id); ?>"> <?php set_query_var( 'postid', $post_months->ID); ?> <?php get_template_part( 'template-parts/common/m-post_thumbnail' ); ?> </a> <figcaption> <a href="<?php the_permalink($post_months->ID); ?>"> <?php $post = get_post( $post_months_id ); $post_title = sanitize_post_field( 'post_title', $post->post_title, $post_months_id, 'display' ); //echo $post_title; ?> <?php echo get_the_title( $post_months->ID ); ?> </a> </figcaption> </figure> </div> <?php //endwhile;?> <?php endforeach; ?> <?php else: ?> <p>記事がありません</p> <?php endif; ?> <?php wp_reset_postdata(); ?>
回答1件
あなたの回答
tips
プレビュー