<?php $image = fw_ssd_get_option('header-search-image'); if ($image) { $bg_image = wp_get_attachment_image_src($image['attachment_id'], 'ssd_single-post-image'); $image_url = $bg_image['0']; } else { $image_url = ''; } // Categories $term_args = array('hide_empty' => 0); $deal_cats = get_terms('deal_category', $term_args); ?> <div class="header-screen"> <div class="bg-image parallax" data-bgimage="<?php echo esc_url($image_url); ?> "></div> <div class="overlay-dark"></div> <div class="header-screen-content"> <form action="<?php echo esc_url(home_url("/")); ?> " method="get" class="header-screen-search"> <span><?php esc_html_e("I'm searching for", 'couponhut'); ?> </span> <input type="text" name="s" placeholder="<?php esc_attr_e('Deals & Coupons', 'couponhut');
<?php if (get_query_var('paged')) { $paged = get_query_var('paged'); } else { if (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } set_query_var('paged', $paged); } $args = array('post_type' => 'deal', 'posts_per_page' => fw_ssd_get_option('deals-per-page'), 'paged' => $paged); $args['orderby'] = 'comment_count'; $args['order'] = ' desc'; // Query only not expired deals $args['meta_query'] = array('relation' => 'OR', array('key' => 'expiring_date', 'value' => date('Ymd'), 'compare' => '>=', 'type' => 'UNSIGNED'), array('key' => 'expiring_date', 'value' => '')); $deals_query = new WP_Query($args); // The Query ?> <?php /** * Posts Loop */ if ($deals_query->have_posts()) { ?> <div class="isotope-wrapper" data-isotope-cols="3" data-isotope-gutter="30">
/** * Front End Deal Submit */ function _action_ssd_acf_submit_deal($post_id) { if (empty($_POST['acf'])) { return; } if (!isset($_POST['deal_submit'])) { return; } $fields = $_POST['acf']; $post = array('ID' => $post_id, 'post_title' => $_POST['post_title'], 'post_content' => $_POST['post_content']); // Update the Post wp_update_post($post); // Deal Information $title = $_POST['post_title']; $content = $_POST['post_content']; $deal_type = $fields['field_5519756e0f4e2']; $deal_summary = $fields['field_554f8e55b6dd8']; $coupon_code = $fields['field_551976780f4e4']; $discount_value = $fields['field_55016e0911ba1']; $url = $fields['field_55016e3011ba3']; $expiring_date = $fields['field_55016e3d11ba4']; $admin_page = admin_url('edit.php?post_status=pending&post_type=deal'); $message = __('New deal has been submited. Here are the details:', 'couponhut') . "\n\n\n" . __('Deal Name:', 'couponhut') . " {$title}\n\n\n" . __('Deal Type:', 'couponhut') . " {$deal_type}\n\n\n" . __('Deal Summary:', 'couponhut') . " {$deal_summary}\n\n\n" . __('Coupon Code:', 'couponhut') . " {$coupon_code}\n\n\n" . __('Discount:', 'couponhut') . " {$discount_value}\n\n\n" . __('Content:', 'couponhut') . " {$content}\n\n\n" . __('Deal URL:', 'couponhut') . " {$url}\n\n\n" . __('Expiring Date:', 'couponhut') . " {$expiring_date}\n\n\n" . __('Please visit your admin dashboard to approve it - ', 'couponhut') . " {$admin_page}"; $email_to = fw_ssd_get_option('new-deal-email'); wp_mail($email_to, __('New Deal Submited', 'couponhut'), $message); }
?> <div id="post-<?php the_ID(); ?> " <?php post_class('page-wrapper'); ?> > <div class="container"> <div class="row"> <div class="col-sm-8 col-md-9 <?php echo fw_ssd_get_option('sidebar-switch') == 'left' ? 'col-sm-push-4 col-md-push-3' : ''; ?> "> <?php if (have_posts()) { ?> <div class="section-title"> <h3><?php esc_html_e('Search Results For: ', 'couponhut'); the_search_query(); ?> </h3> </div>
<div class="container footer-wrapper"> <div class="row"> <?php get_template_part('partials/content', 'footer-widgets'); ?> </div> <div class="row"> <div class="col-sm-12"> <section class="copyright"> <?php echo wp_kses_post(fw_ssd_get_option('copyright-text')); ?> </section> </div> </div> </div><!-- end container --> </footer> <?php } ?>
?> </div><!-- end single-deal-summary --> <?php } ?> <?php $current_date = date('Y/m/d'); if (!get_field('expiring_date') || $current_date < get_field('expiring_date')) { if (get_field('deal_type') == 'discount') { echo '<a href="' . get_field('url') . '" target="_blank" class="btn btn-color btn-deal" data-post_id="' . get_the_ID() . '">' . fw_ssd_get_option('buy-now-text') . '</a>'; } else { $enable_redirect = get_field('redirect_to_offer') ? get_field('redirect_to_offer') : array(''); echo '<a href="' . esc_url(get_field('url')) . '" target="_blank" class="btn btn-color btn-deal show-coupon-code" data-target="#discount-modal" data-clipboard-text="' . esc_attr(get_field('coupon_code')) . '" data-redirect="' . $enable_redirect[0] . '">' . fw_ssd_get_option('show-code-text') . '</a>'; } } else { echo '<button class="btn btn-deal btn-disabled">' . esc_html__('Deal Expired', 'couponhut') . '</button>'; } ?> <?php if (get_field('discount_value')) { ?> <div class="discount-ribbon"> <?php echo wp_kses_post(get_field('discount_value')); ?>
</nav> <?php } ?> </div><!-- end col-sm-9 --> </div><!-- end container --> </div><!-- end navigation-wrapper --> <div class="nav-offset"></div> <?php $show_search = false; switch (get_post_type(get_the_ID())) { case 'post': $show_search = fw_ssd_get_option('search-screen-post-switch') == 'show' ? true : false; break; case 'deal': $show_search = fw_ssd_get_option('search-screen-deal-switch') == 'show' ? true : false; break; case 'page': if (is_page_template('template-submit-deal.php')) { $show_search = false; } else { $show_search = get_field('search_header') == 'show' ? true : false; } break; } if ($show_search || is_archive() || is_search()) { get_template_part('partials/content', 'header-screen'); }
<?php if (is_active_sidebar('sidebar-blog')) { ?> <div class="col-sm-4 col-md-3 <?php echo fw_ssd_get_option('sidebar-switch') == 'left' ? 'col-sm-pull-8 col-md-pull-9' : ''; ?> "> <div class="sidebar"> <?php dynamic_sidebar('sidebar-blog'); ?> </div><!-- end sidebar --> </div><!-- end col-sm-4 col-md-3 --> <?php }
array_push($cats_array, $cat_link); } } $cats_string = implode(', ', $cats_array); ?> <div class="card-deal-categories"><?php echo $cats_string; ?> </div> <!-- Rating --> <div class="card-deal-meta-rating"> <?php if (fw_ssd_get_option('rating-switch') == 'show') { ?> <?php $rating_average = get_post_meta($post->ID, 'rating_average', true); if (empty($rating_average)) { update_post_meta($post->ID, 'rating_average', 0); $rating_average = 0; } $rating_count_total = get_post_meta($post->ID, 'rating_count_total', true); if (empty($rating_count_total)) { update_post_meta($post->ID, 'rating_count_total', 0); $rating_count_total = 0; } ?>
function fw_ssd_twitter_feed($count = 3, $user = '******') { $twitter_key = fw_ssd_get_option('consumer_key'); $twitter_secret = fw_ssd_get_option('consumer_secret'); $twitter_token = fw_ssd_get_option('access_token'); $twitter_token_secret = fw_ssd_get_option('access_token_secret'); $i = 0; $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; $getfield = '?screen_name=' . $user . '&count=' . $count; $requestMethod = 'GET'; $return = array(); if (empty($twitter_key) || empty($twitter_secret) || empty($twitter_token) || empty($twitter_token_secret)) { $settings = array('consumer_key' => '', 'consumer_secret' => '', 'oauth_access_token' => '', 'oauth_access_token_secret' => ''); } else { $settings = array('consumer_key' => fw_ssd_get_option('consumer_key'), 'consumer_secret' => fw_ssd_get_option('consumer_secret'), 'oauth_access_token' => fw_ssd_get_option('access_token'), 'oauth_access_token_secret' => fw_ssd_get_option('access_token_secret')); } if ($url === '' || $getfield === '' || $requestMethod === '') { return; } $exchanger = new TwitterAPIExchange($settings); if (is_wp_error($exchanger)) { return ''; } $tweets = $exchanger->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest(); $tweets = json_decode($tweets, true); if (empty($tweets)) { return $return; } if (!empty($tweets['errors'])) { if (current_user_can('edit_theme_options')) { $return = array('error' => esc_html__('Make sure Twitter Consumer Key and Access Token are set.', 'couponhut')); } return $return; } foreach ($tweets as $tweet) { $tweet_text = !empty($tweet['text']) ? $tweet['text'] : ''; $tweet_date = !empty($tweet['created_at']) ? fw_ssd_twitter_relative_time($tweet['created_at']) : ''; /* * Replace URLs to working Links */ $tweet_text = preg_replace('/\\b(?:(http(s?):\\/\\/)|(?=www\\.))(\\S+)/is', '<a href="http$2://$3" target="_blank">$1$3</a>', $tweet_text); /* * match name@address */ $tweet_text = preg_replace("/\\b([a-zA-Z][a-zA-Z0-9\\_\\.\\-]*[a-zA-Z]*\\@[a-zA-Z][a-zA-Z0-9\\_\\.\\-]*[a-zA-Z]{2,6})\\b/i", "<a href=\"mailto://\$1\" class=\"twitter-link\">\$1</a>", $tweet_text); /* * Replace username start by @ to working link */ $tweet_text = preg_replace('/([\\.|\\,|\\:|\\¡|\\¿|\\>|\\{|\\(]?)@{1}(\\w*)([\\.|\\,|\\:|\\!|\\?|\\>|\\}|\\)]?)\\s/i', "\$1<a href=\"http://twitter.com/\$2\" class=\"twitter-user\">@\$2</a>\$3 ", $tweet_text); /* * Replace hash (#) to search link */ $tweet_text = preg_replace('/\\s#(\\w+)/', ' <a href="//twitter.com/search?q=$1">#$1</a>', $tweet_text); $return[$i]['tweet'] = $tweet_text; $return[$i]['time'] = $tweet_date; $i++; } return (array) $return; }
<div class="sort-deals"> <?php $filter_items = array('rating' => esc_html__('Most appreciated', 'couponhut'), 'expiring' => esc_html__('Expiring soon', 'couponhut'), 'popular' => esc_html__('Popular', 'couponhut'), 'newest' => esc_html__('Newest', 'couponhut')); $filter_items_final = array(); // will be filled with only the selected sorting tabs from the option panel $default_sort = fw_ssd_get_option('default-sort-deals-tab'); foreach ($filter_items as $key => $value) { if (in_array($key, fw_ssd_get_option('sort-deals-tab'))) { $filter_items_final[$key] = $value; } } /* Print Sorting Tabs */ foreach ($filter_items_final as $key => $value) { if (isset($_GET['sort'])) { if ($_GET['sort'] == $key) { $filter_class = 'btn-sort current'; } else { $filter_class = 'btn-sort'; } } elseif ($key == $default_sort) { $filter_class = 'btn-sort current'; } else { $filter_class = 'btn-sort'; } ?> <a href="<?php echo add_query_arg('sort', $key); ?> " class="<?php echo $filter_class;
function fw_ssd_custom_styles() { $logo_padding = esc_attr(fw_ssd_get_option('top_logo_padding')); $color_main = esc_attr(fw_ssd_get_option('color-main')); $color_secondary = esc_attr(fw_ssd_get_option('color-secondary')); $color_fill = esc_attr(fw_ssd_get_option('color-fill')); $color_secondary_light = esc_attr(fw_ssd_get_option('color-secondary-light')); ?> <style type="text/css"> /* Logo */ .navigation-wrapper .site-logo { padding: <?php echo $logo_padding; ?> ; } /* Main Color */ .main-navigation a:hover { color: <?php echo $color_main; ?> ; } .main-navigation .current-menu-item > a { color: <?php echo $color_main; ?> ; } .menu-item-has-children > a > i { color: <?php echo $color_main; ?> ; } .single-deal-expires-text { color: <?php echo $color_main; ?> ; } .single-deal-countdown i { color: <?php echo $color_main; ?> ; } .single-post-meta i { background-color: <?php echo $color_main; ?> ; } .single-taxonomy-icon { color: <?php echo $color_main; ?> ; } .featured-deals-slider .jscountdown-wrap { border-bottom: 2px solid <?php echo $color_main; ?> ; } .discount-ribbon { background-color: <?php echo $color_main; ?> ; } .dropdown-menu > li > a:focus, .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .dropdown-menu > li > a:hover { background-color: <?php echo $color_main; ?> ; } .list-menu-title i { color: <?php echo $color_main; ?> ; } .list-menu > li > a { border-left: 0 solid <?php echo $color_main; ?> ; } .list-menu > li > a:hover, .list-menu > li > a:focus { border-left: 4px solid <?php echo $color_main; ?> ; } .card-deal-meta-expiring .jscountdown-wrap { color: <?php echo $color_main; ?> ; } .footer .tagcloud a { background-color: <?php echo $color_main; ?> ; } .footer .tagcloud a:after { border-color: transparent transparent transparent <?php echo $color_main; ?> ; } .ui-slider-handle { background-color: <?php echo $color_main; ?> ; } .daily-deal-widget-wrapper .jscountdown-wrap { border-bottom: 2px solid <?php echo $color_main; ?> ; } .daily-deal-title a:hover { color: <?php echo $color_main; ?> ; } /* Secondary Color */ a:hover, a:active { color: <?php echo $color_secondary; ?> ; } ::-moz-selection { background: <?php echo $color_secondary; ?> ; } ::selection { background: <?php echo $color_secondary; ?> ; } .input-group-btn { background-color: <?php echo $color_secondary; ?> ; } .single-taxonomy-website i { color: <?php echo $color_secondary; ?> ; } .header-screen-search input[type="text"] { border-bottom: 2px solid <?php echo $color_secondary; ?> ; } .btn:hover, input[type="submit"]:hover, input[type="button"]:hover, .btn:active, input[type="submit"]:active, input[type="button"]:active, .btn.current, input.current[type="submit"], input.current[type="button"], button[type='submit']:hover, button[type='submit']:active, button[type='submit'].current, input[type='submit']:hover, input[type='submit']:active, input[type='submit'].current { background: <?php echo $color_secondary; ?> ; border: 4px solid <?php echo $color_secondary; ?> ; } .btn.btn-social:hover > i, input.btn-social[type="submit"]:hover > i, input.btn-social[type="button"]:hover > i { color: <?php echo $color_secondary; ?> ; } .btn.btn-color, input.btn-color[type="submit"], input.btn-color[type="button"], .btn.btn-color:focus, input.btn-color[type="submit"]:focus, input.btn-color[type="button"]:focus, button[type='submit'], button[type='submit']:focus, input[type='submit'], input[type='submit']:focus { background: <?php echo $color_secondary; ?> ; border: 4px solid <?php echo $color_secondary; ?> ; } .highlight { background-color: <?php echo $color_secondary; ?> ; } blockquote { border-color: <?php echo $color_secondary; ?> ; } .fw-accordion .fw-accordion-title.ui-state-active { border-bottom: 2px solid <?php echo $color_secondary; ?> ; } .fw-tabs-container .fw-tabs ul { border-bottom: 2px solid <?php echo $color_secondary; ?> ; } .fw-tabs-container .fw-tabs ul li.ui-state-active { background: <?php echo $color_secondary; ?> ; } .see-more i { color: <?php echo $color_secondary; ?> ; } .see-more:hover span { color: <?php echo $color_secondary; ?> ; } .btn-dropdown[aria-expanded="true"], .btn-dropdown[aria-expanded="true"]:hover { background-color: <?php echo $color_secondary; ?> ; } .list-menu .number-counter { background-color: <?php echo $color_secondary; ?> ; } .modal-body { border-bottom: 4px dashed <?php echo $color_secondary; ?> ; } .btn-card-deal { background-color: <?php echo $color_secondary; ?> ; } .card-deal-categories a:hover { color: <?php echo $color_secondary; ?> ; } .grid-item h2 { color: <?php echo $color_secondary; ?> ; } .sort-deals .btn-sort.current { border: 2px solid <?php echo $color_secondary; ?> ; } .sort-deals .btn-sort:hover { background-color: <?php echo $color_secondary; ?> ; } .page-numbers:hover, .page-numbers:focus, .page-numbers:active, .page-numbers.current { background-color: <?php echo $color_secondary; ?> ; } .days-slider-numbers { color: <?php echo $color_secondary; ?> ; } .widget_deal_categories .overlay-color, .widget_deal_companies .overlay-color { background-color: <?php echo $color_secondary; ?> ; } .widget_twitter a { color: <?php echo $color_secondary; ?> ; } /* Color Fill */ .main-navigation .sub-menu a:hover { color: <?php echo $color_fill; ?> ; } .main-navigation .sub-menu .current-menu-item > a { color: <?php echo $color_fill; ?> ; } .box-icon i { background-color: <?php echo $color_fill; ?> ; } .poster-block a:before { border: 1px solid <?php echo $color_fill; ?> ; } .featured-deals-slider .deal-slide-categories { color: <?php echo $color_fill; ?> ; } .post-meta-date i { color: <?php echo $color_fill; ?> ; } .overlay-color { background-color: <?php echo $color_fill; ?> ; } .tags-list a:hover, .tagcloud a:hover { background-color: <?php echo $color_fill; ?> ; } .tags-list a:hover:after, .tagcloud a:hover:after { border-color: transparent transparent transparent <?php echo $color_fill; ?> ; } .widget > ul li:before { color: <?php echo $color_fill; ?> ; } .widget-title { border-left: 3px solid <?php echo $color_fill; ?> ; } .widget-list a:hover { color: <?php echo $color_fill; ?> ; } .widget-list .widget-list-number-counter { background-color: <?php echo $color_fill; ?> ; } .widget_twitter li:before { color: <?php echo $color_fill; ?> ; } /* Main Color Light */ .btn.btn-color:hover, input.btn-color[type="submit"]:hover, input.btn-color[type="button"]:hover, button[type='submit']:hover, input[type='submit']:hover { background-color: <?php echo $color_secondary_light; ?> ; border: 4px solid <?php echo $color_secondary_light; ?> ; } /* Typography */ <?php $body_font = fw_ssd_get_option('body_font'); $heading_font = fw_ssd_get_option('heading_font'); ?> body, .days-slider-days-text { <?php echo fw_ssd_typography_css($body_font); ?> } h1, h2, h3, h4, h5, h6, .main-navigation, .days-slider-numbers { <?php echo fw_ssd_typography_css($heading_font); ?> } /* Custom CSS */ <?php echo esc_attr(fw_ssd_get_option('custom-css')); ?> </style> <?php }
<?php // Admin Send Deal Mail $email_to = fw_ssd_get_option('new-deal-email'); // Allow deal submit without registration $allow_no_reg = fw_ssd_get_option('member-submit-switch'); if (function_exists('um_profile_id') || $allow_no_reg) { if (function_exists('um_profile_id') && !um_profile_id()) { wp_redirect(home_url('login/')); exit; } if ($email_to) { acf_form_head(); } /* Template Name: Submit Deal */ get_header(); ?> <div id="post-<?php the_ID(); ?> " <?php post_class('page-wrapper'); ?> > <div class="container"> <div class="row">
Template name: Browse Categories */ get_header(); ?> <div id="post-<?php the_ID(); ?> " <?php post_class('page-wrapper'); ?> > <?php $args = array('hide_empty' => false, 'orderby' => fw_ssd_get_option('order-categories'), 'order' => fw_ssd_get_option('order-categories') == 'name' ? 'ASC' : 'DESC'); $terms = get_terms('deal_category', $args); if (!empty($terms) && !is_wp_error($terms)) { ?> <div class="container"> <div class="row"> <div class="col-sm-8 col-md-9"> <div class="section-title-block"> <h1 class="section-title"><?php the_title(); ?>