Friends I have a menu with the following links from the Products and News categories I want when clicking on any of the links and my category.php < strong> return only posts from the category you clicked on.
I have in my page single_cat_title (); that returns the category name, I would like to know how I can get the ID of this category to use in the $ args array
$ args = array ('post_type' => 'post', 'category' = > CATEGORY_CODE , 'showposts' => 3);
<div class="container">
<?php
$args = array('post_type'=>'post', 'category'=>single_cat_title(), 'showposts'=>3);
$my_posts = get_posts( $args );
if($my_posts) : foreach($my_posts as $post) : setup_postdata( $post );
?>
<div class="row">
<div class="col-md-3 col-lg-3">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(false, array('class'=>'img-responsive img-post-blog')); ?></a>
</div>
<div class="col-md-9 col-lg-9">
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
</div>
</div>
<?php
endforeach;
endif;
?>
</div>