Advertisement
Guest User

travel-log-child-testimonial

a guest
May 9th, 2019
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.11 KB | None | 0 0
  1. if ( ! function_exists( 'travel_log_front_page_testimonials_content_modified' ) ) :
  2.  
  3.     function travel_log_front_page_testimonials_content_modified() {
  4.  
  5.         // $enabled = travel_log_get_theme_option( 'testimonials_enable' );
  6.         // if ( false === $enabled ) {
  7.         //  return;
  8.         // }
  9.  
  10.         $title = travel_log_get_theme_option( 'testimonials_title' );
  11.  
  12.         $category = travel_log_get_theme_option( 'testimonials_category' );
  13.  
  14.         $testimonials_content_type = travel_log_get_theme_option( 'home_testimonials_content_type' );
  15.  
  16.         $bg_url = travel_log_get_theme_option( 'testimonials_bg_url' );
  17.  
  18.         $inline_style = ( '' !== $bg_url ) ? 'background-image: url( ' . esc_url( $bg_url ) . ' )' : '';
  19.         ?>
  20.         <section id="travel-testimonial" class="travel-testimonial" style="<?php echo esc_attr( $inline_style ); ?>">
  21.         <div class="theme-overlay"></div>
  22.             <div class="container">
  23.                 <div class="testimonial-wrapper">
  24.                     <div class="row">
  25.                         <div class="col-sm-10 col-xs-12">
  26.                             <?php if ( '' !== $title ) : ?>
  27.                                 <h2 class="section-title"><?php echo esc_html( $title ); ?></h2>
  28.                             <?php endif; ?>
  29.                         </div>
  30.                     </div>
  31.                     <div class="row">
  32.                         <div class="container">
  33.                             <div class="col-sm-12">
  34.                             <!--travel featured slider-->
  35.                                 <div id="testimonial-slider" class="testimonial-slider clearfix">
  36.                                 <div class="testimonial slider" <?php echo is_rtl() ? 'dir="rtl"' : '' ; ?> >
  37.                                     <?php
  38.  
  39.                                     if (  class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'custom-content-types' ) && 'jetpack-testimonials' === $testimonials_content_type  ) :
  40.  
  41.                                         $args['post_type'] = 'jetpack-testimonial';
  42.  
  43.                                         else :
  44.  
  45.                                             $args['category_name'] = $category;
  46.  
  47.                                             endif;
  48.  
  49.                                         $args['posts_per_page'] = apply_filters( 'travel_log_testimonials_posts_limit', 6 );
  50.                                         $testimonials = new WP_Query( $args );
  51.                                         if ( $testimonials->have_posts() ) :
  52.                                             while ( $testimonials->have_posts() ) :
  53.                                                 $testimonials->the_post();
  54.                                             ?>
  55.                                             <div class="testimonial-content">
  56.                                                     <div class="client-img wrap">
  57.                                                     <?php
  58.                                                     if ( has_post_thumbnail() ) :
  59.  
  60.                                                         the_post_thumbnail( 'thumbnail' );
  61.  
  62.                                                         else :
  63.  
  64.                                                         ?>
  65.  
  66.                                                             <img src="<?php echo get_template_directory_uri() . '/images/dummy-user.jpg'; ?>">
  67.  
  68.                                                         <?php
  69.  
  70.                                                         endif;
  71.                                                         ?>
  72.                                                         </div>
  73.                                                     <div class="client-content">
  74.                                                         <div class="testimonial-quote-left clearfix">
  75.                                                         <i class="fa fa-quote-left" aria-hidden="true"></i>
  76.                                                         </div>
  77.                                                         <?php the_excerpt(); ?>
  78.                                                         <div class="client-bio"><div class="name-id"><?php the_title(); ?></div></div>
  79.                                                     <div class="testimonial-quote-right clearfix">
  80.                                                         <i class="fa fa-quote-right" aria-hidden="true"></i>
  81.                                                     </div>
  82.                                                     </div>
  83.                                                 </div>
  84.                                             <?php
  85.                                             endwhile;
  86.                                             wp_reset_postdata();
  87.  
  88.                                             elseif ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'custom-content-types' ) && 'jetpack-testimonials' == $testimonials_content_type ) :
  89.                                                 if ( is_user_logged_in() && current_user_can( 'edit_posts' ) ) :?>
  90.  
  91.                                                     <?php esc_html_e( 'Please add testimonial posts in the jetpack testimonials post type', 'travel-log' ); ?>
  92.  
  93.                                                 <?php endif;
  94.                                             endif; ?>
  95.                                         </div>
  96.                                     </div>
  97.                                     </div>
  98.                                 </div>
  99.                             </div>
  100.                         </div>
  101.                     </div>
  102.             </section>
  103.         <?php
  104.     }
  105.  
  106. endif;
  107.  
  108.  
  109. function travel_log_front_page_testimonials_wrap_child() {
  110.  
  111.         $enabled = travel_log_get_theme_option( 'testimonials_enable' );
  112.         if ( ! is_customize_preview() && false === $enabled ) {
  113.             return;
  114.         }
  115.         echo '<div id="travel-log-front-page-testimonials-modified-wrap" class="travel-log-show-partial-edit-shortcut">';
  116.  
  117.         travel_log_front_page_testimonials_content_modified();
  118.  
  119.         echo '</div>';
  120.     }
  121.  
  122.     add_action( 'travel_log_front_page_content', 'travel_log_front_page_testimonials_wrap_child', 51 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement