How to make a custom post query in WordPress

global $post;
$posts = get_posts(array(
    'post_type' => 'post',
    'post_status' => 'publish',
    'orderby' => 'date',
    'order' => 'DESC',
    'posts_per_page' => -1,
    'cat' => 1,
));

foreach ($posts as $post) {
    setup_postdata($post);
    // the_title();
    // the_content('', false);
}

wp_reset_postdata();