if (!empty($top20)) { ?> <div class="row"> <?php $counter = 0; foreach ($top20 as $code_id) { $code = get_post($code_id); $code_meta = get_post_meta($code->ID); $code_type = coupon_get_smeta('code_type', $code_meta, '2'); $code_text = coupon_get_smeta('code_text', $code_meta, ''); $code_conditions = coupon_get_smeta('code_conditions', $code_meta, ''); $expire_timestamp = coupon_get_smeta('code_expire', $code_meta, time()); $code_api = coupon_get_smeta('code_api', $code_meta, ''); $shop_id = coupon_get_smeta('code_shop_id', $code_meta, ''); $coupon_label = coupon_get_smeta('coupon_label', $code_meta, ''); $code_couponcode = coupon_get_smeta('code_couponcode', $code_meta, ''); if ($counter == $max_count) { $counter = 0; ?> </div> <div class="row"> <?php } $counter++; ?> <!-- item-1 --> <div class="featured-item-container col-md-<?php echo $col_md; ?> "> <div class="featured-item">
<?php get_header(); the_post(); get_template_part('includes/inner_header'); $post_meta = get_post_meta(get_the_ID()); $offer_expire = coupon_get_smeta('offer_expire', $post_meta, ''); $offer_images = coupon_smeta_images('offer_images', $post_meta, array(), get_the_ID()); $offer_url = coupon_get_smeta('offer_url', $post_meta, ''); $promo_text = coupon_get_smeta('promo_text', $post_meta, ''); $page_content = get_the_content(); ?> <!-- ===================================================================================================================================== B L O G - S I N G L E C O N T E N T ====================================================================================================================================== --> <section class="daily_offers"> <div class="container"> <div class="row"> <div class="col-md-12"> <div class="caption category-caption"> <h2><?php echo coupon_page_title(); ?> </span> </h2> <p><?php echo coupon_page_subtitle(); ?> </p>
public function widget($args, $instance) { extract($args); $title = empty($instance['title']) ? __('Daily Offer', 'coupon') : $instance['title']; $offer_id = $instance['offer_id']; if (!empty($offer_id)) { $daily = get_post($offer_id); $post_meta = get_post_meta($offer_id); $promo_text = coupon_get_smeta('promo_text', $post_meta, ''); $offer_expire = coupon_get_smeta('offer_expire', $post_meta, ''); $offer_expire = coupon_get_smeta('offer_expire', $post_meta, ''); $offer_url = coupon_get_smeta('offer_url', $post_meta, ''); $offer_shop_logo = coupon_get_smeta('offer_shop_logo', $post_meta, ''); $offer_shop_url = coupon_get_smeta('offer_shop_url', $post_meta, ''); echo $before_widget . $before_title . $title . $after_title; echo ' <!-- widget-content --> <div class="widget-content"> <!-- coupon-timer --> <div class="time"> <div class="time-caption caption"> <a href="' . esc_url(get_permalink($daily->ID)) . '" class="green pack">' . $daily->post_title . '</a> <p>' . $promo_text . '</p> </div> ' . (!empty($offer_expire) ? '<!-- countdown --> <div class="time-content"> <span class="coupon-meta-caption">' . __('Time Left To Buy', 'coupon') . '</span> <!-- COUNTDOWN --> <div class="countdown" data-time="' . esc_attr($offer_expire) . '" data-button_url="' . esc_url($offer_url) . '" data-button_text="' . esc_attr__('Buy Now', 'coupon') . '" data-days_text="' . esc_attr__('days', 'coupon') . '" data-day_text="' . esc_attr__('day', 'coupon') . '"> </div> </div> <!-- .countdown -->' : '') . ' </div> <!-- .coupon-timer --> </div> <!-- .widget-content --> '; echo $after_widget; wp_reset_query(); } }
<?php $post_meta = get_post_meta(get_the_ID()); $promo_text = coupon_get_smeta('promo_text', $post_meta, ''); $offer_expire = coupon_get_smeta('offer_expire', $post_meta, ''); $offer_expire = coupon_get_smeta('offer_expire', $post_meta, ''); $offer_shop_logo = coupon_get_smeta('offer_shop_logo', $post_meta, ''); $offer_shop_url = coupon_get_smeta('offer_shop_url', $post_meta, ''); $offer_url = coupon_get_smeta('offer_url', $post_meta, ''); if ($counter == $max_count) { $counter = 0; ?> </div> <div class="row"> <?php } $counter++; ?> <!-- item-1 --> <div class="featured-item-container col-md-<?php echo $col_md; ?> "> <div class="featured-item"> <?php if (has_post_thumbnail() || !empty($offer_shop_logo)) { ?> <div class="logotype logotype-no-padding"> <div class="logotype-image"> <?php if (!empty($offer_shop_logo)) {
<?php $code_id = get_the_ID(); $code_meta = get_post_meta($code_id); $code_type = coupon_get_smeta('code_type', $code_meta, '2'); $code_discount = coupon_get_smeta('code_discount', $code_meta, ''); $code_text = coupon_get_smeta('code_text', $code_meta, ''); $expire_timestamp = coupon_get_smeta('code_expire', $code_meta, time()); $code_conditions = coupon_get_smeta('code_conditions', $code_meta, ''); $code_api = coupon_get_smeta('code_api', $code_meta, ''); $code_couponcode = coupon_get_smeta('code_couponcode', $code_meta, ''); $shop_id = coupon_get_smeta('code_shop_id', $code_meta, ''); $coupon_label = coupon_get_smeta('coupon_label', $code_meta, ''); $remaining = coupon_remaining_time($expire_timestamp); $arrow_fix = ''; if (empty($code_api) && empty($code_couponcode) || $coupon_label == 'discount' && empty($code_api)) { $arrow_fix = 'arrow_fix'; } ?> <!-- coupon-box-1 --> <div class="coupon-box <?php echo $remaining == 0 ? 'expired' : ''; ?> col-md-12"> <div class="blog-inner col-md-12"> <!-- row --> <div class="row">
<?php /********************************************************************** *********************************************************************** COUPON SHOP SINGLE **********************************************************************/ get_header(); the_post(); get_template_part('includes/inner_header'); $shop_id = get_the_ID(); $shop_meta = get_post_meta($shop_id); $shop_link = coupon_get_smeta('shop_link', $shop_meta, ''); ?> <!-- show show details --> <?php $cur_page = get_query_var('page') ? get_query_var('page') : 1; //get curent page $args = array('post_type' => 'code', 'post_status' => 'publish', 'posts_per_page' => coupon_get_option('shop_listing_per_page'), 'code_category' => get_query_var('term'), 'meta_key' => 'code_expire', 'orderby' => 'meta_value_num', 'order' => 'desc', 'paged' => $cur_page, 'meta_query' => array('relation' => "AND", array('key' => 'code_for', 'value' => 'all_users', 'compare' => '='), array('key' => 'code_shop_id', 'value' => $shop_id, 'compare' => '='))); if (!empty($_GET['label_var'])) { $args['meta_query'][] = array('key' => 'coupon_label', 'value' => $_GET['label_var'], 'compare' => '='); } $main_query = new WP_Query($args); $page_links_total = $main_query->max_num_pages; $page_links = paginate_links(array('base' => add_query_arg('page', '%#%'), 'prev_next' => true, 'end_size' => 2, 'mid_size' => 2, 'total' => $page_links_total, 'current' => $cur_page, 'prev_next' => false, 'type' => 'array')); $pagination = coupon_format_pagination($page_links); ?> <section class="shop-single"> <!-- container --> <div class="container"> <!-- row -->
function coupon_get_code() { $codeid = $_POST['codeid']; $response = array(); $code = get_post($codeid); if (!empty($code)) { coupon_register_click($codeid); $code_meta = get_post_custom($codeid); $code_couponcode = coupon_get_smeta('code_couponcode', $code_meta, ''); $shop_id = coupon_get_smeta('code_shop_id', $code_meta, ''); $thumb_id = get_post_thumbnail_id($shop_id); $image = wp_get_attachment_image_src($thumb_id, 'top20'); $response['image'] = !empty($image) ? $image[0] : ''; $response['title'] = $code->post_title; $response['text'] = $code->post_content; $response['code'] = $code_couponcode; } else { $response['error'] = __('Coupon does not exists', 'coupon'); } echo json_encode($response); die; }