public static function display_voyages($query) { $voyages = ""; if ($query->have_posts()) { $voyages .= "<div id=\"slides\" class='main-slider'>"; $voyages .= "<ul class=\"slides-container\">"; while ($query->have_posts()) { $query->the_post(); $voyages .= " <li>"; $id = $query->post->ID; $post = get_post($id); $feature_image = wp_get_attachment_url(get_post_thumbnail_id($id)); $voyages .= "<img src=\"{$feature_image}\" alt=\"\" class=\"ui image\"/>"; $voyages .= "<div class=\"ui container\">\r\n <div class=\"ui grid\">\r\n <div class=\"twelve wide column\" id=\"slider-text\">\r\n <h1 class=\"fitText\" style=\"text-transform:uppercase\">" . get_the_title($id) . "</h1>\r\n <h4>" . get_the_excerpt() . "</h4>\r\n <br>\r\n <a href=\"" . get_permalink($id) . "\" class=\"ui huge animated fade inverted button\" tabindex=\"0\">\r\n <div class=\"visible content\">" . Voyage::price($id) . "</div>\r\n <div class=\"hidden content\">\r\n " . __('More info', 'sage') . "\r\n </div>\r\n </a>\r\n </div>\r\n </div>\r\n </div>"; $voyages .= " </li>"; } $voyages .= "</ul>"; $voyages .= "</div>"; } else { $voyages .= "<h3>" . __("Sorry, No voyages", "sage") . "</h3>"; } echo $voyages; wp_reset_postdata(); }
public static function get_post_data($posttype, $component, $id = false) { $info = array(); if ($id !== false) { $post_link = get_permalink($id); } else { $post_link = '#'; } $images = array(); if ($component == 'theme') { $images = Voyage::get_voyage_images($id); $terms = get_the_terms($id, 'theme'); $term = $terms[0]; $info['post_link'] = $post_link; $info['title'] = ucwords(get_the_title($id)); $info['subtitle'] = $term->name; $info['image_url'] = $images['image_url']; $info['thumbnail_image'] = $images['thumbnail_image']; $info['thumbnail_url'] = $images['thumbnail_url']; } if ($component == 'promotions') { $images = Voyage::get_voyage_images($id); if (!empty($images)) { $info['post_link'] = $post_link; $info['title'] = ucwords(get_the_title($id)); $info['subtitle'] = get_post_meta($id, 'slogan')[0]; $info['image_url'] = $images['image_url']; $info['thumbnail_image'] = $images['thumbnail_image']; $info['thumbnail_url'] = $images['thumbnail_url']; } } if ($component == 'brochures') { $images = Voyage::get_voyage_images($id); if (!empty($images)) { $info['post_link'] = $images['image_url']; $info['title'] = ucwords(get_the_title($id)); $info['subtitle'] = get_post_meta($id, 'slogan')[0]; $info['image_url'] = $images['image_url']; $info['thumbnail_image'] = $images['thumbnail_image']; $info['thumbnail_url'] = $images['thumbnail_url']; } } if ($component == 'all' && $posttype != 'team' && $posttype != 'jetpack-testimonial' && $posttype != 'facility') { $images = Voyage::get_voyage_images($id); if (!empty($images)) { $info['post_link'] = $post_link; $info['title'] = ucwords(get_the_title($id)); $info['subtitle'] = ''; $info['image_url'] = $images['image_url']; $info['thumbnail_image'] = $images['thumbnail_image']; $info['thumbnail_url'] = $images['thumbnail_url']; } } if ($posttype == 'team') { //Users $users = Users::getUserList(['contributor'], true); foreach ($users as $user) { $user_id = $user['ID']; $row['post_link'] = $post_link; $row['title'] = Users::getFullName($user_id); $row['image_url'] = Users::getProfilePicture($user_id); $row['thumbnail_image'] = Users::getProfilePicture($user_id, 'thumbnail_image'); $row['thumbnail_url'] = Users::getProfilePicture($user_id, 'thumbnail_url'); $job_title = Users::getJobTitle($user_id); $social = Users::getContactButtons($user); $subtitle = ''; if (!empty($job_title)) { if (!empty($social)) { $subtitle = $job_title . '<br><br>' . $social; } else { $subtitle = $job_title; } } else { if (!empty($social)) { $subtitle = $social; } } $row['subtitle'] = $subtitle; $info[] = $row; $row = array(); } } if ($posttype == 'jetpack-testimonial' || $posttype === 'facility') { $info['post_link'] = $post_link; $info['title'] = ucwords(get_the_title($id)); $info['subtitle'] = Post::getPostContent($id); $images = Post::getImages($id); if (!empty($images)) { $info['image_url'] = $images['image_url']; $info['thumbnail_image'] = $images['thumbnail_image']; $info['thumbnail_url'] = $images['thumbnail_url']; } else { $info['image_url'] = '#'; $info['thumbnail_image'] = '#'; $info['thumbnail_url'] = '#'; } } if ($component == 'location') { $images = Voyage::get_voyage_images($id); if (!empty($images)) { $terms = get_the_terms($id, 'location'); $term = $terms[0]; $info['post_link'] = $post_link; $info['title'] = ucwords(get_the_title($id)); $info['subtitle'] = $term->name; $info['image_url'] = $images['image_url']; $info['thumbnail_image'] = $images['thumbnail_image']; $info['thumbnail_url'] = $images['thumbnail_url']; } } return $info; }
$voyage_included = get_post_meta(get_the_ID(), 'included', true); $voyage_not_included = get_post_meta(get_the_ID(), 'not_included', true); $voyage_cancelation = get_post_meta(get_the_ID(), 'cancelation', true); $voyage_payment = get_post_meta(get_the_ID(), 'payment', true); $gallery = get_post_meta(get_the_ID(), 'gallery', false); ?> <br> <table class="ui table basic unstackable" style="color:white;"> <tr> <td><i class="money icon"></i><strong><?php _e('Price', 'sage'); ?> </strong></td> <td> <strong><?php echo Voyage::price($post->ID); ?> </strong> </td> </tr> <tr> <td><i class="calendar icon"></i><strong><?php _e('Duration'); ?> </strong></td> <td> <strong> <?php $number_days = get_post_meta(get_the_ID(), 'days', true); $number_nights = get_post_meta(get_the_ID(), 'nights', true); if ($number_days) {
</h2> </div> <div class="eleven wide column"> <?php foreach ($host_options as $option) { ?> <?php if (!empty($option['establishment_name'])) { ?> <h3 class="ui header"> <?php echo $option['establishment_name']; ?> <div class="sub header"> <?php echo Voyage::host_rating_stars($option['establishment_rating']); ?> </div> </h3> <?php if (!empty($option['establishment_gallery']) && !empty($option['establishment_gallery'][0])) { ?> <div id="host-gallery"> <?php foreach ($option['establishment_gallery'] as $image) { ?> <div> <img src="<?php echo wp_get_attachment_url($image); ?> " class="ui image" />
<div class="content"> Voyages <div class="sub header"></div> </div> </h1> <div id="search-results" class="search-results"> <?php $query = new WP_Query($args); $data = array(); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $id = $query->post->ID; $title = get_the_title($id); $post_link = get_permalink($id); $images = Voyage::get_voyage_images($id); /*echo "Encontrado:".$title; echo"<pre>"; print_r($images); echo"</pre>";*/ $info['post_link'] = $post_link; $info['image_url'] = $images['image_url']; $info['title'] = $title; $data[] = $info; } /*echo"<pre>"; print_r($data); echo"</pre>";*/ Card::display_card_simple($data); //Showcase::get_component('card',$data); ?>
public static function getPostBasicInfo($post_type, $taxonomy, $terms, $all_content = true) { $posts = self::getPostByPostTypeTaxonomyAndTerm($post_type, $taxonomy, $terms); $data = array(); if (!empty($posts)) { foreach ($posts as $post) { $id = $post->ID; $image = false; if (in_array('voyage', $post_type)) { $images = \Voyage::get_voyage_images_list($id); if (!empty($images)) { $image = $images[0]; } } else { if (in_array('attachment', $post_type)) { $feat_image = wp_get_attachment_url($id); if ($feat_image) { $image = $feat_image; } } else { $feat_image = wp_get_attachment_url(get_post_thumbnail_id($id)); if ($feat_image) { $image = $feat_image; } } } $title = get_the_title($id); $excerpt = self::getPostExcerpt($id); $url = get_permalink($id); if ($excerpt === false || empty($excerpt)) { $excerpt = self::getPostContent($id); if ($excerpt === false || empty($excerpt)) { $excerpt = ''; } else { if (!$all_content) { $excerpt = substr($excerpt, 0, 30) . '...'; } } } $content = self::getPostContent($id); $row['id'] = $id; $row['title'] = $title; $row['content'] = $content; $row['excerpt'] = $excerpt; $row['url'] = $url; if ($image && !empty($image)) { $row['image'] = $image; } else { $row['image'] = get_stylesheet_directory_uri() . '/assets/images/mauritius.jpg'; } $data[] = $row; } } return $data; }
} ?> <?php $post_status = get_post_status($post->ID); ?> <?php $countries = get_the_terms($post->ID, 'country'); ?> <?php $locations = get_the_terms($post->ID, 'location'); ?> <?php if ($voyage_expiry_date && $voyage_expiry_date_formatted >= date("Y-m-d")) { ?> <?php $gallery = Voyage::get_voyage_images_list($post->ID); ?> <?php $overlay = get_stylesheet_directory_uri() . '/bower_components/vegas/dist/overlays/07.png'; ?> <script type="text/javascript"> jQuery(function() { jQuery('.voyage-slider').vegas({ overlay: '<?php echo $overlay; ?> ', slides: [ <?php foreach ($gallery as $image) { ?>