$package_ribbon = 'normal-type'; $package_type_text = $translator_learn_more; } } // package thumbnail print_single_package_thumbnail(get_the_ID(), $item_size, $package_ribbon, $package_type_text); echo '<div class="package-content-wrapper">'; // package information echo '<div class="package-info-wrapper">'; $date_type = get_post_meta(get_the_ID(), 'package-date-type', true); if ($date_type == 'Fixed') { $start_date = get_post_meta(get_the_ID(), 'package-start-date', true); $end_date = get_post_meta(get_the_ID(), 'package-end-date', true); echo '<div class="package-info"><i class="icon-time"></i>'; echo '<span class="head">' . $translator_duration . ' </span>'; echo get_package_date($start_date, $end_date, $gdl_date_format); echo '</div>'; } else { if ($date_type == 'Duration') { echo '<div class="package-info"><i class="icon-time"></i>'; echo '<span class="head">' . $translator_duration . ' </span>'; echo get_post_meta(get_the_ID(), 'package-duration', true); echo '</div>'; } } // package location $location = get_post_meta(get_the_ID(), 'package-location', true); if (!empty($location)) { echo '<div class="package-info"><i class="icon-location-arrow"></i>'; echo '<span class="head">' . $translator_location . ' </span>'; echo do_shortcode($location);
function widget($args, $instance) { global $gdl_widget_date_format, $blog_port_widget_size; extract($args); $title = apply_filters('widget_title', $instance['title']); $post_cat = $instance['post_cat']; $show_num = $instance['show_num']; if ($post_cat == "All") { $post_cat = ''; } // Opening of widget echo $before_widget; // Open of title tag if ($title) { echo $before_title . $title . $after_title; } // Widget Content wp_reset_query(); $current_post = array(get_the_ID()); $custom_posts = get_posts(array('post_type' => 'package', 'showposts' => $show_num, 'package-category' => $post_cat, 'post__not_in' => $current_post, 'suppress_filters' => '0')); if (!empty($custom_posts)) { echo "<div class='gdl-recent-post-widget'>"; foreach ($custom_posts as $custom_post) { ?> <div class="recent-post-widget"> <?php $thumbnail_id = get_post_thumbnail_id($custom_post->ID); $thumbnail = wp_get_attachment_image_src($thumbnail_id, $blog_port_widget_size); if ($thumbnail_id) { echo '<div class="recent-post-widget-thumbnail">'; echo '<a href="' . get_permalink($custom_post->ID) . '">'; $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); if (!empty($thumbnail)) { echo '<img src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/>'; } echo '</a>'; echo '</div>'; } ?> <div class="recent-post-widget-context"> <h4 class="recent-post-widget-title"> <a href="<?php echo get_permalink($custom_post->ID); ?> "> <?php _e($custom_post->post_title, 'gdl_front_end'); ?> </a> </h4> <div class="recent-post-widget-info"> <div class="recent-post-widget-date"><i class="icon-time"></i> <?php $date_type = get_post_meta($custom_post->ID, 'package-date-type', true); if ($date_type == 'Fixed') { $start_date = get_post_meta($custom_post->ID, 'package-start-date', true); $end_date = get_post_meta($custom_post->ID, 'package-end-date', true); echo get_package_date($start_date, $end_date, $gdl_widget_date_format); } else { if ($date_type == 'Duration') { echo get_post_meta($custom_post->ID, 'package-duration', true); } } ?> </div> </div> </div> <div class="clear"></div> </div> <?php } echo "</div>"; } // Closing of widget echo $after_widget; }
function print_medium_package($item_class, $item_size, $num_excerpt) { global $gdl_admin_translator, $post, $gdl_date_format, $package_id; if ($gdl_admin_translator == 'enable') { $translator_learn_more = get_option(THEME_SHORT_NAME . '_translator_read_more_package', 'Learn More'); $translator_book_now = get_option(THEME_SHORT_NAME . '_translator_book_now_package', 'Book Now!'); $translator_last_minute = get_option(THEME_SHORT_NAME . '_translator_last_minute_package', 'Last Minute'); } else { $translator_learn_more = __('Learn More', 'gdl_front_end'); $translator_book_now = __('Book Now!', 'gdl_front_end'); $translator_last_minute = __('Last Minute', 'gdl_front_end'); } if (empty($package_id)) { $package_id = 0; } $contact_form = get_option(THEME_SHORT_NAME . '_booknow_contact_shortcode'); if (!empty($contact_form)) { echo '<div class="book-now-contact hidden" id="gdl-booknow-' . $package_id . '">'; echo do_shortcode($contact_form); echo '</div>'; } while (have_posts()) { the_post(); echo '<div class="' . $item_class . '">'; $package_type = get_post_meta(get_the_ID(), 'package-type', true); if ($package_type == 'Last Minute') { $package_ribbon = 'last-minute'; $package_type_text = '<span class="head">' . $translator_last_minute . '</span>'; $package_type_text .= '<span class="discount-text">'; $package_type_text .= get_post_meta(get_the_ID(), 'package-type-text', true); $package_type_text .= '</span>'; } else { if ($package_type == 'None') { $package_ribbon = ''; $package_type_text = ''; } else { $package_ribbon = 'normal-type'; $package_type_text = $translator_learn_more; } } // package thumbnail print_package_thumbnail(get_the_ID(), $item_size, $package_ribbon, $package_type_text); echo '<div class="package-content-wrapper">'; // package title echo '<h2 class="package-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>'; // package information $date_type = get_post_meta(get_the_ID(), 'package-date-type', true); if ($date_type == 'Fixed') { $start_date = get_post_meta(get_the_ID(), 'package-start-date', true); $end_date = get_post_meta(get_the_ID(), 'package-end-date', true); echo '<div class="package-date"><i class="icon-time"></i>'; echo get_package_date($start_date, $end_date, $gdl_date_format); echo '</div>'; } else { if ($date_type == 'Duration') { echo '<div class="package-date"><i class="icon-time"></i>'; echo get_post_meta(get_the_ID(), 'package-duration', true); echo '</div>'; } } // package content echo '<div class="package-content">'; if (!empty($post->post_excerpt)) { echo do_shortcode(get_the_excerpt()); } else { echo gdl_get_excerpt($num_excerpt, '... '); } echo '</div>'; // package price if ($package_type == 'Learn More') { $price = get_post_meta(get_the_ID(), 'package-price', true); if (!empty($price)) { echo '<div class="package-info"><i class="icon-tag"></i>'; echo '<span class="package-price">'; echo do_shortcode($price); echo '</span>'; echo '</div>'; } } else { if ($package_type == 'Last Minute') { $price = get_post_meta(get_the_ID(), 'package-price', true); if (!empty($price)) { echo '<div class="package-info last-minute"><i class="icon-tag"></i>'; echo '<span class="normal-price">'; echo do_shortcode($price); echo '</span>'; echo '<span class="discount-price">'; echo get_post_meta(get_the_ID(), 'package-last-minute-widget-text', true); echo '</span>'; echo '</div>'; //package-info-inner } } } // book now button if (!empty($contact_form)) { echo '<a class="package-book-now-button gdl-button large various" '; echo ' href="#gdl-booknow-' . $package_id . '" data-fancybox-type="inline" data-rel="fancybox" '; echo ' data-title="' . get_the_title() . '" data-url="' . get_permalink() . '" >'; echo $translator_book_now; echo '</a>'; } echo '</div>'; // blog-context-wrapper echo '<div class="clear"></div>'; echo '</div>'; // package-item } $package_id++; }