Function
Render the announcement of a running sale.
tml_admin_promotion_notice( )
Source
function tml_admin_promotion_notice() {
$promotion = tml_admin_get_promotion();
if ( ! $promotion ) {
return;
}
$notice_key = sanitize_key( 'promotion-' . $promotion['code'] . '-' . $promotion['ends'] );
if ( tml_admin_notice_is_dismissed( $notice_key ) ) {
return;
}
// Ends are exclusive, so the last moment of the sale is a second earlier.
$ends = wp_date( get_option( 'date_format' ), $promotion['ends'] - 1, new DateTimeZone( $promotion['timezone'] ) );
?>
<div class="notice notice-info tml-notice is-dismissible" data-notice="<?php echo esc_attr( $notice_key ); ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( $notice_key ) ); ?>">
<p>
<?php
echo wp_kses(
sprintf(
/* translators: 1: Sale name, 2: Discount such as 30%, 3: Discount code, 4: Last day of the sale. */
__( '<strong>%1$s:</strong> %2$s off Theme My Login extensions with code <strong>%3$s</strong>, through %4$s.', 'theme-my-login' ),
esc_html( $promotion['name'] ),
esc_html( $promotion['discount'] ),
esc_html( $promotion['code'] ),
esc_html( $ends )
),
array( 'strong' => array() )
);
?>
</p>
<p><a class="button button-primary" href="<?php echo esc_url( $promotion['url'] ); ?>" target="_blank"><?php esc_html_e( 'Shop Extensions', 'theme-my-login' ); ?></a></p>
</div>
<?php
}
Uses
Used by
Changelog
| Version | Description |
|---|---|
| 7.3 | Introduced. |