[Plugin: TBTestimonials] Show all testimonials for just ONE category
-
Hiya
This may be of use to you. I wanted to show all testimonials but just for one category. Bit of a hack (I’m sure Travis will do something way more elegant) but you can do this by –
1) Add a shortcode in your page/post of =
[testimonial id='cat=Company testimonial']
… where Company testimonial is the testimonial category name.
2) In the tb-testimonials.php file, go to the shortcode() function and add another IF (in my version here it was added at line 424)
elseif($id<>'') # category based - added by Mark { $cat = split("cat=",$id); $q = new WP_Query( array( 'post_type'=>'testimonial','post_status'=>'publish','showposts'=>'-1','order_by'=>'menu_order','testimonial_category'=>$cat[1])); if( $q->have_posts() ) { $return = '<div id="tbtestimonial-listing">'; while( $q->have_posts() ) { $q->the_post(); $return .= $this->prepare_testimonial( 'shortcode-all' ); } return $return . '</div>'; } else return; }
And that’s it!
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘[Plugin: TBTestimonials] Show all testimonials for just ONE category’ is closed to new replies.