I have code like this:

<div class="featured-title"><h3>Paket Lainnya</h3></div>
<div class="boxer2">
<?php $this_post = $post;
$category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;
$posts = get_posts('numberposts=7&offset=0&orderby=rand&order=DESC&category='.$category);
$count = 0;
foreach ( $posts as $post ) {
if ( $post->ID == $this_post->ID || $count == 6) {
unset($posts[$count]);
}else{
$count ++;
}
}
?>
<?php if ( $posts ) : ?>
<?php foreach ( $posts as $post ) : ?>
<div class="col-md-4"><?php get_template_part( 'thumb' ); ?></div>
<?php endforeach ?>
<?php endif ?>
<?php wp_reset_query(); ?> 
</div>
</div>
</div>
</div>

What do i expect?

I want to change the code to display the results of a certain category by entering the category id.
I have set up the category id that is 9

Read more here: How to display certain categories based on id


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: