Skip to content

Commit

Permalink
step #5 - template 9 integrated 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
codewithabdulrahman committed Nov 11, 2021
1 parent 713ec23 commit 9f6dc2c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 26 deletions.
47 changes: 28 additions & 19 deletions includes/classes/wpcd-preview-metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function generate_fields( $post ) {
if ( !function_exists( 'wpcd_coupon_thumbnail_img' ) ) {
include WPCD_Plugin::instance()->plugin_includes . 'functions/wpcd-coupon-thumbnail-img.php';
}

$post_id = get_the_ID();
$title = get_the_title();
$description = get_post_meta( $post_id, 'coupon_details_description', true );
Expand Down Expand Up @@ -112,25 +112,25 @@ public function generate_fields( $post ) {
$wpcd_text_to_show = get_option( 'wpcd_text-to-show' );
$wpcd_custom_text = get_option( 'wpcd_custom-text' );
$wpcd_eight_btn_text = get_option( 'wpcd_eight-button-text' );

/** Alternative Template Variables */
global $coupon_id;
$disable_coupon_title_link = get_option( 'wpcd_disable-coupon-title-link' );
$coupon_title_tag = get_option( 'wpcd_coupon-title-tag', 'h1' );
$dt_coupon_type_name = get_option( 'wpcd_dt-coupon-type-text' );

/** Seven Template Variables */
$never_expire = get_post_meta( $coupon_id, 'coupon_details_never-expire-check', true );


if ( $wpcd_text_to_show == 'description' ) {
$wpcd_custom_text = $description;
} else {
if ( empty( $wpcd_custom_text ) ) {
$wpcd_custom_text = __( "Click on 'Copy' to Copy the Coupon Code.", 'wp-coupons-and-deals' );
}
}

if ( $expireDateFormat == 'mm/dd/yy' ) {
$expireDateFormatFun = 'm/d/Y';
} elseif ( $expireDateFormat == 'yy/mm/dd' ) {
Expand All @@ -148,7 +148,7 @@ public function generate_fields( $post ) {
$third_expire_date = date( $expireDateFormatFun, $third_expire_date );
}
$expire_date_format = date( "m/d/Y", strtotime( $expire_date ) );

/** Setting Default Values if Empty */
$title = ( !empty( $title ) ) ? $title : __( 'Sample Coupon Title' );
$description = ( !empty( $description ) ) ? $description : __( 'This is the description of the coupon code. Additional details of what the coupon or deal is.' );
Expand Down Expand Up @@ -268,22 +268,31 @@ class="wpcd-btn masterTooltip wpcd-deal-button"
<div class="wpcd-coupon-nine-header">
<div class="wpcd-col-1-4">
<h1 class="wpcd-coupon-title">
<a href="#" target="_blank" rel="nofollow">' . esc_html( $title ) . '</a></h1>
<a href="#" target="_blank" rel="nofollow">' . esc_html($title) . '</a>
</h1>
</div>
<div class="wpcd-col-1-4 second-div">
<div class="wpcd-coupon-not-hidden">
<div class="wpcd-coupon-code wpcd-col-2-4">
<button
class="wpcd-btn masterTooltip wpcd-coupon-button"
title="' . esc_attr( $coupon_hover_text ) . '"
data-clipboard-text="'. esc_attr( $coupon_code ) . '">
<span class="wpcd_coupon_icon"></span>
<span class="coupon-code-button">' . esc_html( $coupon_code ) . '</span>
</button>
</div>
</div>
<div class="wpcd-coupon-code wpcd-col-2-4">
<button rel="nofollow"
class="wpcd-btn-' . absint($coupon_id) . ' masterTooltip wpcd-btn wpcd-coupon-button"
title="' . esc_attr($coupon_hover_text) . '"
data-clipboard-text="' . esc_attr($coupon_code) . '">
<span class="wpcd_coupon_icon">
<img class="" src="' . esc_url(WPCD_Plugin::instance()->plugin_assets . 'img/coupon-code-24.png') . '" style="width: 100%;height: 100%;" >
</span>
' . esc_html($coupon_code) . '
</button>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", function() {
var clip = new ClipboardJS("'.esc_attr( $button_class ).'");
});
</script>
</div>
<div class="clearfix"></div>
</div><!-- End of Template Nine Preview -->
Expand Down
31 changes: 24 additions & 7 deletions includes/templates/shortcode/shortcode-nine__premium_only.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,37 @@
<div class="wpcd-col-1-4 second-div">
<div class="wpcd-coupon-not-hidden">
<div class="wpcd-coupon-code wpcd-col-2-4">
<button
class="wpcd-btn masterTooltip wpcd-coupon-button"
title="<?= esc_html($coupon_hover_text) ?>"
data-clipboard-text="<?= esc_html($coupon_code) ?>">
<span class="wpcd_coupon_icon"></span>
<span class="coupon-code-button"><?= esc_html($coupon_code) ?></span>
</button>
<a rel="nofollow" href="<?php echo esc_url( $link ); ?>"
class="<?php echo 'wpcd-btn-' . absint( $coupon_id ); ?> masterTooltip wpcd-btn wpcd-coupon-button"
target="<?php echo esc_attr( $target ); ?>"
title="<?php if( !WPCD_Amp::wpcd_amp_is() ) {
if ( ! empty( $coupon_hover_text ) ) {
echo esc_attr( $coupon_hover_text );
} else {
echo __( "Click To Copy Coupon", 'wp-coupons-and-deals' );
}
}
?>"
data-clipboard-text="<?php echo esc_attr( $coupon_code ); ?>">
<span class="wpcd_coupon_icon">
<img class="" src="<?php echo esc_url( WPCD_Plugin::instance()->plugin_assets . 'img/coupon-code-24.png' ) ?>" style="width: 100%;height: 100%;" >
</span>

<?php echo esc_html( $coupon_code ); ?>
</a>
</div>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
</div><!-- End of Template Nine Preview -->
<script type="text/javascript">
window.addEventListener('DOMContentLoaded', function() {
var clip = new ClipboardJS('.<?php echo esc_attr( $button_class ); ?>');
});

</script>

<?php
if (!WPCD_Amp::wpcd_amp_is() && !empty($show_print_links) && $show_print_links == 'on') {
Expand Down

0 comments on commit 9f6dc2c

Please sign in to comment.