<?php

$leap_below_post_banner = get_post_meta( leap_get_current_page_id(), 'leap_below_post_banner', TRUE );
if ( $leap_below_post_banner != 'default' ) {
	if ( $leap_below_post_banner != 'none' ) {
		echo '<div class="below-post-banner">';
		if ( $leap_below_post_banner == 'image' ) {
			$leap_below_post_banner_image	 = get_post_meta( leap_get_current_page_id(), 'leap_below_post_banner_image', TRUE );
			$leap_below_post_banner_link	 = get_post_meta( leap_get_current_page_id(), 'leap_below_post_banner_link', TRUE );
			$leap_below_post_banner_target	 = get_post_meta( leap_get_current_page_id(), 'leap_below_post_banner_target', TRUE );
			$target							 = '';
			if ( $leap_below_post_banner_target == 'on' ) {
				$target = 'target="_blank"';
			}
			if ( $leap_below_post_banner_link ) {
				echo '<a href="' . esc_url( $leap_below_post_banner_link ) . '" ' . $target . '>';
			}

			if ( $leap_below_post_banner_image ) {
				echo '<img alt="" src="' . esc_url( $leap_below_post_banner_image ) . '" />';
			}

			if ( $leap_below_post_banner_link ) {
				echo '</a>';
			}
		}

		if ( $leap_below_post_banner == 'code' ) {
			echo get_post_meta( leap_get_current_page_id(), 'leap_below_post_banner_code', TRUE );
		}

		echo '</div>';
	}
} else {
	$below_post_banner = ot_get_option( 'below_post_banner', 'none' );
	if ( $below_post_banner != 'none' ) {
		echo '<div class="below-post-banner">';
		if ( $below_post_banner == 'image' ) {
			$below_post_banner_image	 = ot_get_option( 'below_post_banner_image', '' );
			$below_post_banner_link		 = ot_get_option( 'below_post_banner_link', '' );
			$below_post_banner_target	 = ot_get_option( 'below_post_banner_target', 'on' );
			$target						 = '';
			if ( $below_post_banner_target == 'on' ) {
				$target = 'target="_blank"';
			}
			if ( $below_post_banner_link ) {
				echo '<a href="' . esc_url( $below_post_banner_link ) . '" ' . $target . '>';
			}

			if ( $below_post_banner_image ) {
				echo '<img alt="" src="' . esc_url( $below_post_banner_image ) . '" />';
			}

			if ( $below_post_banner_link ) {
				echo '</a>';
			}
		}

		if ( $below_post_banner == 'code' ) {
			echo ot_get_option( 'below_post_banner_code', '' );
		}

		echo '</div>';
	}
}
