2つのカスタム投稿タイプと特定タームでの一覧
-
カスタム投稿(info)と別のカスタム投稿(menu)のターム(orange)を
一緒の一覧に表示したく苦戦しております。1)カスタム投稿:info
※タクソノミー、タームなし2)カスタム投稿:menu
タクソノミー:drink
ターム:orange、appleなど上記条件にて、日付順で最新記事10件を取得したいです。
それぞれ個別の取得は下記で可能でした。カスタム投稿:info
<?php $args = array( 'post_type' => array('info'), 'orderby' => 'date', 'posts_per_page' => 5 ); ?> <?php $custom_query = new WP_Query( $args ); if ( $custom_query->have_posts() ): while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?> <p><?php the_time('Y年m月j日'); ?> <a href="<?php the_permalink() ?>"><?php the_title(); ?></a></p> <?php endwhile; endif; ?> <?php wp_reset_query(); ?>
カスタム投稿:menuのターム:orange
<?php $args = array( 'post_type' => 'menu', 'taxonomy' => 'drink', 'term' => 'orange', 'posts_per_page' => 5, 'numberposts' => '-1', ); $my_posts = get_posts($args); foreach ( $my_posts as $post ) { setup_postdata($post); ?> <p><?php the_time('Y年m月j日'); ?> <a href="<?php the_permalink() ?>"><?php the_title(); ?></a></p> <?php } ?>
これをどう、一緒に一覧にして、日付順で10件取得したら良いか悩んでおります。
どうぞ宜しくお願い致します。
1件の返信を表示中 - 1 - 1件目 (全1件中)
1件の返信を表示中 - 1 - 1件目 (全1件中)
- トピック「2つのカスタム投稿タイプと特定タームでの一覧」には新たに返信することはできません。