single.phpの
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
~略~ <!--関連記事--> <h4 class="kanren">関連記事</h4> <div class="sumbox02"> <div id="topnews"> <div> <?php $categories = get_the_category($post->ID); $category_ID = array(); foreach($categories as $category): array_push( $category_ID, $category -> cat_ID); endforeach ; $args = array( 'post__not_in' => array($post -> ID), 'posts_per_page'=> 10, 'category__in' => $category_ID, 'orderby' => 'rand', ); $st_query = new WP_Query($args); ?> <?php if( $st_query -> have_posts() ): ?> <?php while ($st_query -> have_posts()) : $st_query -> the_post(); ?> ~略~ |
の
1 |
'orderby' => 'rand', |
を削除すればOKです。