Use this code ,
<?php
$args = array(
'posts_per_page' => -1,
'offset' => 1,
'category' => 4,
'numberposts' => -1
);
$pages = get_pages($args);
$i = 1;
foreach ($pages as $page) {
if ($i == 1) { ?>
<div class="carousel-item active" style="background-image: url('<?php echo get_bloginfo('template_url'); ?>/img/intro-carousel/1.jpg');">
<div class="carousel-container">
<div class="carousel-content">
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($page->ID), 'optional-size'); ?>
<h2><?php echo $page->post_title; ?></h2>
<p>
<?php echo strip_tags(get_the_excerpt()); ?>
<span>Convert Visitors Into Customers And Generate More Sales</span>
</p>
<a href="#about" class="btn-get-started scrollto">
<img src="<?php echo $image[0]; ?>" alt="arrow"/>
</a>
</div>
</div>
</div>
<?php } else { ?>
<div class="carousel-item" style="background-image: url('<?php echo get_bloginfo('template_url'); ?>/img/intro-carousel/1.jpg');">
<div class="carousel-container">
<div class="carousel-content">
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($page->ID), 'optional-size'); ?>
<h2><?php echo $page->post_title; ?></h2>
<p>
<?php echo strip_tags(get_the_excerpt()); ?>
<span>Convert Visitors Into Customers And Generate More Sales</span>
</p>
<a href="#about" class="btn-get-started scrollto">
<img src="<?php echo $image[0]; ?>" alt="arrow"/>
</a>
</div>
</div>
</div>
<?php }
$i++;
}
wp_reset_query();
?>