<?php
$category_slug = get_query_var('category_name');
$args = array(
'orderby' => 'rand',//ランダム表示
'category_name' => $category_slug // 取得したカテゴリーのスラッグを指定
);?>
<?php $the_query = new WP_Query($args);
if ($the_query->have_posts()) :
while ($the_query->have_posts()) : $the_query->the_post();?>
//ループ内容
<?php endwhile; endif;?>
<?php wp_reset_postdata();?>