Skip to content

Instantly share code, notes, and snippets.

@picocodes
Created January 4, 2023 06:35
Show Gist options
  • Save picocodes/83a231e55df5aa144204d880cfd62aed to your computer and use it in GitHub Desktop.
Save picocodes/83a231e55df5aa144204d880cfd62aed to your computer and use it in GitHub Desktop.
Customize zone template
<?php
/**
* Contains the zone template.
*
* You can override this template by copying it to your-theme/gpa/zone.php
*
* @var Adv_Zone_Template $zone The zone to display.
*/
defined( 'ABSPATH' ) || exit;
$show_advertisement_link = 0 < count( $zone->get_ads() ) && ! $zone->zone->is_full();
$link_position = (int) $zone->zone->get( 'link_position' );
$adverisement_url = adv_get_zone_advertisement_url( $zone->get_id() );
?>
<div data-id="<?php echo absint( $zone->get_id() ); ?>" class="bsui adv-single-zone id-<?php echo absint( $zone->get_id() ); ?>">
<div class="<?php echo esc_attr( adv_zone_wrapper_class( $zone->get_ads() && $zone->zone->get( 'width' ) ) ); ?>">
<div class="h5">ADVERTISEMENT</div>
<?php if ( $adverisement_url && ( 2 === $link_position || 3 === $link_position ) ) : ?>
<div>
<a class="text-dark" href="<?php echo esc_url( $adverisement_url ); ?>"><?php esc_html_e( 'Advertise Here' ); ?></a>
</div>
<?php endif; ?>
<?php adv_get_template( 'zone-ads.php', array( 'zone' => $zone ) ); ?>
<?php if ( $adverisement_url && ( 1 === $link_position || 3 === $link_position ) ) : ?>
<div>
<a class="text-dark" href="<?php echo esc_url( $adverisement_url ); ?>"><?php esc_html_e( 'Advertise Here' ); ?></a>
</div>
<?php endif; ?>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment