Advertisement
Guest User

wp-travel-customize

a guest
Mar 11th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.24 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Itinerary Shortcode Contnet Template
  4.  *
  5.  * This template can be overridden by copying it to yourtheme/wp-travel/shortcode/itinerary-item.php.
  6.  *
  7.  * HOWEVER, on occasion wp-travel will need to update template files and you (the theme developer).
  8.  * will need to copy the new files to your theme to maintain compatibility. We try to do this.
  9.  * as little as possible, but it does happen. When this occurs the version of the template file will.
  10.  * be bumped and the readme will list any important changes.
  11.  *
  12.  * @see         http://docs.wensolutions.com/document/template-structure/
  13.  * @author      WenSolutions
  14.  * @package     wp-travel/Templates
  15.  * @since       1.0.2
  16.  */
  17.  
  18. if ( ! defined( 'ABSPATH' ) ) {
  19.     exit; // Exit if accessed directly
  20. }
  21.  
  22.  
  23. if ( post_password_required() ) {
  24.     echo get_the_password_form();
  25.     return;
  26. }
  27. $post_id        = get_the_ID();
  28. $enable_sale    = get_post_meta( $post_id, 'wp_travel_enable_sale', true );
  29. $trip_price     = wp_travel_get_trip_price( $post_id );
  30. $sale_price     = wp_travel_get_trip_sale_price( $post_id ); ?>
  31. <li>
  32. <div class="wp-travel-post-item-wrapper">
  33.     <div class="wp-travel-post-wrap-bg">
  34.  
  35.         <div class="wp-travel-post-thumbnail">
  36.             <a href="<?php the_permalink() ?>">
  37.                 <?php echo wp_travel_get_post_thumbnail( $post_id, 'wp_travel_thumbnail' ); ?>
  38.             </a>
  39.             <?php wp_travel_save_offer( $post_id ); ?>
  40.         </div>
  41.         <div class="wp-travel-post-info clearfix">
  42.             <?php do_action( 'wp_tarvel_before_archive_title', get_the_ID() ) ?>
  43.             <h4 class="post-title">
  44.                 <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute( array( 'before' => __( 'Permalink to: ', 'wp-travel' ) ) ); ?>">
  45.                     <?php the_title(); ?>
  46.                 </a>
  47.             </h4>
  48.             <?php do_action( 'wp_travel_after_archive_title', get_the_ID() ) ?>
  49.             <div class="recent-post-bottom-meta">
  50.                 <?php wp_travel_trip_price( $post_id, true ); ?>
  51.             </div>
  52.         </div>
  53.         <div class="wp-travel-post-content">
  54.             <?php wp_travel_get_trip_duration( $post_id ); ?>
  55.             <span class="post-category">
  56.                 <div class="entry-meta">
  57.                     <?php if ( wp_travel_tab_show_in_menu( 'reviews' ) ) : ?>
  58.                         <?php $average_rating = wp_travel_get_average_rating( $post_id ) ?>
  59.                         <div class="wp-travel-average-review" title="<?php printf( esc_attr__( 'Rated %s out of 5', 'wp-travel' ), $average_rating ); ?>">
  60.  
  61.                             <span style="width:<?php echo esc_attr( ( $average_rating / 5 ) * 100 ); ?>%">
  62.                                 <strong itemprop="ratingValue" class="rating"><?php echo esc_html( $average_rating ); ?></strong> <?php printf( esc_html__( 'out of %1$s5%2$s', 'wp-travel' ), '<span itemprop="bestRating">', '</span>' ); ?>
  63.                             </span>
  64.                         </div>
  65.                         <?php $count = (int) wp_travel_get_review_count() ?>
  66.                         <span class="wp-travel-review-text"> (<?php printf( esc_html( _n( '%d Review', '%d Reviews', $count, 'wp-travel' ) ), $count ); ?>)</span>
  67.                     <?php endif; ?>
  68.                     <?php $terms = get_the_terms( $post_id, 'itinerary_types' ); ?>
  69.                     <div class="category-list-items">
  70.                         <?php if ( is_array( $terms ) && count( $terms ) > 0 ) : ?>
  71.                             <i class="wt-icon wt-icon-folder" aria-hidden="true"></i>
  72.                             <?php
  73.                             $first_term = array_shift( $terms );
  74.                             $term_name = $first_term->name;
  75.                             $term_link = get_term_link( $first_term->term_id, 'itinerary_types' ); ?>
  76.                             <a href="<?php echo esc_url( $term_link ); ?>" rel="tag">
  77.                                 <?php echo esc_html( $term_name ); ?>
  78.                             </a>
  79.                             <?php if ( count( $terms ) > 0 ) : ?>
  80.                             <div class="wp-travel-caret">
  81.                                 <i class="wt-icon wt-icon-caret-down"></i>
  82.                                 <div class="sub-category-menu">
  83.                                     <?php foreach( $terms as $term ) : ?>
  84.                                         <?php
  85.                                             $term_name = $term->name;
  86.                                             $term_link = get_term_link( $term->term_id, 'itinerary_types' ); ?>
  87.                                         <a href="<?php echo esc_url( $term_link ); ?>">
  88.                                             <?php echo esc_html( $term_name ); ?>
  89.                                         </a>
  90.                                     <?php endforeach; ?>
  91.                                 </div>
  92.                             </div>
  93.                             <?php endif; ?>
  94.  
  95.                         <?php endif; ?>
  96.                     </div>
  97.  
  98.  
  99.                 </div>
  100.             </span>
  101.             <?php the_excerpt() ?>
  102.         </div>
  103.  
  104.     <?php if ( $enable_sale ) : ?>
  105.         <div class="wp-travel-offer">
  106.             <span><?php esc_html_e( 'Offer', 'wp-travel' ); ?></span>
  107.         </div>
  108.     <?php endif; ?>
  109.  
  110.     </div>
  111. </div>
  112. </li>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement