- Joined
- Jan 22, 2023
- Messages
- 1
- Reaction score
- 0
<?php
$catArgs = array(
'category__in' => wp_get_post_categories($post->ID),
'showposts' => 5,//display number of posts
'orderby' =>'rand',//display random posts
'post__not_in' => array($post->ID)
);
$cat_post_query = new WP_Query($catArgs);
if( $cat_post_query->have_posts() ) {
while ($cat_post_query->have_posts()) : $cat_post_query->the_post(); ?>
<li> <a href="<?php the_permalink() ?>"> <?php the_title(); ?></a></li>
<?php endwhile;
wp_reset_query(); } ?>
$catArgs = array(
'category__in' => wp_get_post_categories($post->ID),
'showposts' => 5,//display number of posts
'orderby' =>'rand',//display random posts
'post__not_in' => array($post->ID)
);
$cat_post_query = new WP_Query($catArgs);
if( $cat_post_query->have_posts() ) {
while ($cat_post_query->have_posts()) : $cat_post_query->the_post(); ?>
<li> <a href="<?php the_permalink() ?>"> <?php the_title(); ?></a></li>
<?php endwhile;
wp_reset_query(); } ?>