Пример #1
0
 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;
 }
Пример #2
0
    }
    ?>
    <?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) {
            ?>