the_excerpt()
is one of a few template tags that do not accept a post ID as a parameter. Instead, you need to set up the global $post
, run your tags, then restore it:
if ( $_post = get_post( 10 ) ) {
setup_postdata( $post = $_post );
the_excerpt();
// Any other template tags for this post
wp_reset_postdata();
}