現在、以下のような記事一覧を表示するphpがあります。
php
1<div class="row"> 2<?php 3$my_query = new WP_Query(array( 4'post_type' => 'post', 5'posts_per_page' => 15, 6'orderby' => 'menu_order', 7'order' => 'ASC', 8)); 9?> 10 11<?php while($my_query->have_posts()) : $my_query->the_post(); ?> 12 13<div class="col-sm-6 a_box"> 14 <a href="<?php the_permalink(); ?>"> 15 <div> 16 17<?php 18$days = 3; 19$today = date_i18n('U'); 20$entry_day = get_the_time('U'); 21$keika = date('U',($today - $entry_day)) / 86400; 22if ( $days > $keika ): 23 echo '<span class="ribon_new">NEW</span>'; 24endif; 25?> 26 27<?php if (has_post_thumbnail()): ?> 28<?php the_post_thumbnail(array( 150, 150 )); ?> 29<?php else: ?> 30<img src="<?php echo bloginfo('template_directory'); ?>/images/common/noimage.jpg" /> 31<?php endif; ?> 32 33<div> 34<p class="upload_date"><?php echo get_the_date('Y年m月d日'); ?></p> 35 <h4><?php the_title(); ?></h4> 36 </div> 37 </div> 38 </a> 39 <p class="tag"><?php the_tags('','','');?></p> 40</div>
1記事当たりのタグを表示する個数を制限できないでしょうか?
今の書き方では4つのタグをつけたら4つ表示され、10個つけたら10個表示されてしまいます。
記事の一覧ではタグを2つに抑え、詳細ページではすべて表示するという事をしたいです。
'posts_per_page' => 15, のように
'tags_per_post' => 2, と出来れば良いのですが、これも用意が無さそう。
どのように上記を変更したらタグの個数を制限できるでしょうか?
よろしくお願いいたします。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/01/30 07:09
2019/01/30 07:17
2019/01/30 07:31 編集
2019/01/30 07:30 編集
2019/01/30 07:36
2019/01/30 07:47 編集
2019/01/30 07:56
2019/01/30 08:02
2019/01/30 08:21
2019/01/30 08:24
2019/01/30 08:52
2019/01/30 09:00