Testimonial Basics: In Code Functions

Display Testimonials in Code

I have developed a function that can be used in the coding of templates for displaying testimonials. It can come in handy when you want to display testimonials from within the code and not in the content of the page. An example of such an application would be in a pre-formatted page where there is a section you want to replace. Such was the case with one of the websites I look after, which was why I developed the function. Below is an example of how to use the function :

  <div class="your_class">
      <?php katb_testimonial_basics_display_in_code( 'group', 'number', 'by', 'id', 'rotate', 'layout', 'schema' ); ?>
   </div>
  • ‘group’ – ‘all’ or group name in quotes
  • ‘number’ – ‘all’ or the number of testimonials you want to display in quotes
  • ‘by’ – ‘date’ or ‘order’ or ‘random’
  • ‘id’ – leave blank ie ” or input the testimonial id’s separated by a comma
  • ‘rotate’ – ‘yes’ or ‘no’
  • ‘layout’ – ‘0’,’1′,’2′,’3′,’4′,’5′, or ‘6’
  • ‘rotate’ – ‘default’,’yes’ or ‘no’

This function uses the shortcode function so testimonials will be listed according to the General and Content Display options.

Display Input Form in Code

You can also include an input form in code,

  <div class="your_class">
     <?php katb_testimonial_basics_input_in_code( 'group', '1' ); ?>
  </div>

Put the group name inside the single quotes that you want the testimonial entered under, default is ‘all’ or ‘All’.

The number inside the quotes is the input form number, default is 1. If you are going to have more than one input form in a page then number each one differently.