ワードプレス
特定テンプレートのみ更新順
<?php $paged = get_query_var('paged') ? get_query_var('paged') : 1; $args = array( 'post_type' => 'post', 'posts_per_page' => 12, 'category_name' => "tokyo,tokyo23,kyushu,kanto,kansai,hokkaido", 'orderby' => 'modified', 'paged' => $paged, ); $the_query = new WP_Query($args); if ($the_query->have_posts()) : ?>
<ul class="clearfix hM01"> <?php while ($the_query->have_posts()) : $the_query->the_post();?> <?php $category = get_the_category(); $cat_name = $category[0]->cat_name; $cat_slug = $category[0]->category_nicename; $field = get_field_object('pref-name'); $value = get_field('pref-name'); $label = $field['choices'][ $value ]; ?> <li> <a href="<?php echo esc_url( home_url( '/' ) ); ?><?php echo $cat_slug; ?>#<?php the_ID(); ?>"><time><?php the_modified_date('Y年m月d日'); ?></time> <?php if(get_field('pref-name')): ?> <?php echo $label; ?> <?php else: ?> <?php echo $cat_name; ?> <?php endif; ?> <?php the_title(); ?> </a> </li> <?php endwhile; ?> </ul> <div class="detailLink"><a href="<?php echo esc_url( home_url( '/' ) ); ?>result">一覧</a></div> <?php else : ?> <div id="worksNon"> 現在、発行実績は御座いません。 </div> <?php endif; wp_reset_query(); ?>