Creating a Paginated TB-Testimonials Output Template
Jan 03 2013 1 Comments
This is something that gets brought up every now and then so I wanted to show you guys a little class I built a while back to help with this and also show off how powerful TB Testimonials really is.
To display the paginated testimonials we will create a new page and then insert a shortcode into it pointing to a new template we’re going to create named ‘paginate’. the shortcode is as follows
[testimonial id="rand" template="paginate"]
and here’s the template code that is used. You add this under Testimonials / Output Settings in your wp-admin. You will probably need to switch it up a little bit to fit your needs a little more but that’s ok.
Now that you have created your template to use we need to include the class I was talking about aptly named TBTestimonialPaginate. Save it to your theme folder and then open your functions.php and add require_once("tbtpaginate.class.php")
to the bottom of it. This is assuming that you named the file tbtpaginate.class.php.
At the bottom you will notice we pass a 5 to the constructor, that’s the number of testimonials to show per page and you can easily change it by editing this number. That’s it, now you can view the page you created with the shortcode in it and see some testimonials with pagination links when the per_page quota is met.
Great Travis !!!
This is exactly what I was looking for !
After little styling with CSS, I’ve recovered a nice testimonial page with ‘next’ and ‘prev’.
I had to remove the ” because Iit was messing up the loop.
Thanks one more time !