How do I get posts from category using the slug?
Replace your category
parameter with category_name
<?php
global $post;
$args = array( 'numberposts' => 10, 'category_name' => 'cat-slug' );
$posts = get_posts( $args );
foreach( $posts as $post ): setup_postdata($post);
?>
<divs with the_title() the_excerpt() etc ></div>
<?php endforeach; ?>
For more info: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
suppose you have category name 'ice cakes' and category slug as 'ice-cakes', then our code to retrieve post under category 'ice cakes' is as follows:
<?php
$args = array( 'posts_per_page' => 3,
'category_name' => 'ice-cakes' );
$icecakes = get_posts( $args );
foreach ( $icecakes as $post ) : setup_postdata( $post ); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach;
wp_reset_postdata(); ?>