Advertisement
iftekharul

Pretty Testimonial

Jan 3rd, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.07 KB | None | 0 0
  1. <?php
  2. /*  Pretty Testimonial  */
  3.  
  4. function testimonial_shortcode($atts){
  5.  
  6. global $pretty_testimonial_options; $pretty_testimonial_settings = get_option( 'pretty_testimonial_options', $pretty_testimonial_options );
  7.  
  8.         extract( shortcode_atts( array(
  9.  
  10.                  'posts_per_page' =>-1,
  11.                  'id' =>'',
  12.                  'category' =>'',
  13.                  'bg_color' => $pretty_testimonial_settings['bg_color'],
  14.                  'content_color' => $pretty_testimonial_settings['content_color'],              
  15.                  'client_title_color' => $pretty_testimonial_settings['client_title_color'],            
  16.                  'client_title_font_size' => $pretty_testimonial_settings['client_title_font_size'],            
  17.                  'name_of_post_color' => $pretty_testimonial_settings['name_of_post_color'],            
  18.                  'post_of_title' =>'',
  19.  
  20.        
  21.         ), $atts, 'testimonials' ) );
  22.        
  23.     ob_start();
  24.     $q = new WP_Query(
  25.          array( 'posts_per_page' =>$posts_per_page, 'post_type' =>'testimonial-items', 'testimonial_cat' =>$category)
  26.         );            
  27.                        
  28. ?>      
  29.         <div style="background-color:'.$bg_color.'" id="testimonial" class="cd-testimonials-wrapper cd-container">
  30.         <ul class="cd-testimonials">
  31. <?php      
  32.         while($q->have_posts()) : $q->the_post();
  33.         $id = get_the_ID();
  34.         $post_thumbnail = get_the_post_thumbnail ( get_the_ID(), 'post_thumbnail' );
  35.         $post_of_title = get_post_meta ($id, 'post_of_title', true); ?>
  36.  
  37.                 <li>
  38.                         <p style="color:<?php echo $content_color; ?>"><?php get_the_content(); ?></p>
  39.                         <div class="cd-author">
  40.                                 <?php echo $post_thumbnail; ?>
  41.                                 <ul class="cd-author-info">
  42.                                         <li style="color:<?php echo $client_title_color; ?>;font-size:<?php echo $client_title_font_size; ?>px;"><?php get_the_title(); ?></li>
  43.                                         <li style="color:<?php echo $name_of_post_color; ?>"><?php echo $post_of_title; ?></li>
  44.                                 </ul>
  45.                         </div>
  46.                 </li>
  47. <?php
  48.         endwhile; ?>
  49.        
  50.         </ul><a href="#0" class="cd-see-all">Show all</a></div>
  51. <?php      
  52.         while($q->have_posts()) : $q->the_post(); ?>
  53.  
  54.                 <div class="cd-testimonials-all"> <div class="cd-testimonials-all-wrapper"> <ul>
  55. <?php      
  56.         endwhile;
  57.        
  58.         while($q->have_posts()) : $q->the_post();
  59.                 $idd = get_the_ID();
  60.                 $post_thumbnail = get_the_post_thumbnail ( get_the_ID(), 'post_thumbnail' ); ?>
  61.                
  62.  
  63.                         <li class="cd-testimonials-item">
  64.                                 <p><?php get_the_content(); ?></p>
  65.                                
  66.                                 <div class="cd-author">
  67.                                         <?php echo $post_thumbnail; ?>
  68.                                         <ul class="cd-author-info">
  69.                                                 <li><?php get_the_title(); ?></li>
  70.                                         </ul>
  71.                                 </div>
  72.                         </li>
  73.                        
  74. <?php      
  75.         endwhile; ?>
  76.        
  77.        
  78.         </ul></div
  79. <?php      
  80.         while($q->have_posts()) : $q->the_post(); ?>
  81.  
  82.                 <a href="#0" class="close-btn"></a></div>
  83. <?php      
  84.         endwhile;      
  85.        
  86.         wp_reset_query(); ?>
  87.        
  88.         <script type="text/javascript">
  89.                 jQuery(document).ready(function($){
  90.                                 jQuery("#testimonial").flexslider({
  91.                                 selector: ".cd-testimonials > li",
  92.                                         animation: "slide"
  93.                                 });
  94.                 });    
  95.         </script>
  96. <?php      
  97.         return ob_get_clean();
  98. }
  99. add_shortcode('testimonial', 'testimonial_shortcode');
  100. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement