<?php if( get_theme_mod( 'about_display_option', true ) ) : 
  
  $aboutPage = get_theme_mod('about_page', '');
  if (!empty($aboutPage)) {
    $aboutPage = get_page_by_path($aboutPage);
    global $post;
    $post = get_post($aboutPage);
    setup_postdata( $post );  
  }

  // title
  if (!empty(get_theme_mod( 'travel_tour_cta_section_title', '' ))) {
    $title = get_theme_mod( 'travel_tour_cta_section_title', '' );
  } else if (!empty( $aboutPage )) {
    $title = get_the_title( $post );
  } else {
    $title = '';
  }

  // excerpt
  if (!empty(get_theme_mod( 'travel_tour_cta_section_excerpt', '' ))) {
    $excerpt = get_theme_mod( 'travel_tour_cta_section_excerpt', '' );
  } else if (!empty( $aboutPage )) {
    $excerpt = get_the_excerpt( $post );
  } else {
    $excerpt = '';
  }

  // CTA link
  if (!empty(get_theme_mod( 'travel_tour_cta_section_button_link', '' ))) {
    $button_url = esc_url( get_theme_mod( 'travel_tour_cta_section_button_link', '' ));
  } else if (!empty( $aboutPage )) {
    $button_url = esc_url( get_permalink( $post ));
  } else {
    $button_url = null;
  }

  // CTA label
  if (!empty(get_theme_mod( 'travel_tour_cta_section_button_label', '' ))) {
    $button_label = get_theme_mod( 'travel_tour_cta_section_button_label', '' );
  } else {
    $button_label = esc_html_e('Read more','default');
  }

  // Image
  if (!empty(get_theme_mod( 'travel_tour_cta_section_image', '' ))) {
    // get image url
    $image_url = get_theme_mod( 'travel_tour_cta_section_image', '' );
  } else if (!empty ( $aboutPage )) {
    $image_url = get_the_post_thumbnail_url( $post );
  } else {
    $image_url = null;
  }
?>
<section class="about-us my-64 position-relative bg-black background-size-cover background-repeat-no background-attachment-fixed background-position-center" style="<?php if ( $image_url ) { ?>background-image: url(<?php echo esc_url($image_url); ?>);<?php } ?>">
  <div class="container-xl">
    <div class="position-absolute top-0 bottom-0 start-0 end-0 z-1 bg-black opacity-50"></div>
    <div class="position-relative d-flex flex-column justify-content-start align-items-center py-96 text-light z-2">
      <h2 class="text-light"><?php esc_html_e($title); ?></h2>
      <p class="mb-40"><?php esc_html_e($excerpt); ?></p> 
      <?php if ($button_url) : ?>
      <a href="<?php echo esc_url($button_url); ?>" title="<?php esc_attr_e($button_label); ?>" class="btn btn-secondary fs-6 py-12 px-24">
        <?php esc_html_e($button_label); ?>
      </a>
      <?php endif; ?>
    </div>
  </div>
</section>
<?php wp_reset_postdata();  endif;