Advertisement
hmbashar

Custom Post Query

Mar 7th, 2015
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1. <?php
  2.     global $post;
  3.     $tesimonial_list = 6;
  4.     $testimonial_cat_id = 8;
  5.     $args = array( 'posts_per_page' => $tesimonial_list, 'post_type'=> 'post', 'meta_key' => $testimonials_order,'orderby' => 'meta_value','order' => $testimonials_order,'category' => $testimonial_cat_id);
  6.     $myposts = get_posts( $args );
  7.     foreach( $myposts as $post ) : setup_postdata($post);
  8. ?> 
  9. <?php
  10.     $testimonials_order= get_post_meta($post->ID, 'testimonial_serial', true);
  11.     $testimonial_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'testimonials' );
  12.     $testimonial_name= get_post_meta($post->ID, 'testimonial_name', true);
  13.     $testimonial_position= get_post_meta($post->ID, 'testimonial_position', true);                     
  14.     $testimonial_website= get_post_meta($post->ID, 'testimonial_website', true);    
  15. ?>
  16.         <!-- single testimonial -->
  17.         <div class="tesimoinal_single floatleft" id="test_monial">
  18.             <div class="tesimonial_bg">
  19.                 <div class="tesimoinal_img">
  20.                     <img src="<?php echo $testimonial_img[0]; ?>" alt="" />
  21.                 </div>
  22.                 <div class="testimonial_text">
  23.                     <p><i class="fa fa-quote-left"></i><?php echo excerpt('35'); ?>....<i class="fa fa-quote-right"></i></p>
  24.                 </div>
  25.                 <div class="testimoinal_link">
  26.                     <a href="<?php the_permalink(); ?>">Read More</a>
  27.                 </div>
  28.             </div>
  29.             <div class="testimonial_tir"></div>
  30.             <div class="tesimonial_author_info">
  31.                 <p class="testimoni_name"><?php echo $testimonial_name; ?></p>
  32.                 <p><?php echo $testimonial_position; ?></p>
  33.                 <p><?php echo $testimonial_website; ?></p>
  34.             </div>
  35.         </div>
  36.         <!-- single testimonial -->
  37.  
  38. <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement