• This would be a great feature for collision testimonials.

    The sidebar widget has no options for which testimonials to display or maximum length.

    For example I have one testimonial that is 77 characters and another that is 1256. That changes the sidebar dramatically. I would like the ability to exclude the longer ones or better yet display maximum number of characters.

    Is there a solution for this or plane to add it as a feature?

    Thanks,
    Len

Viewing 2 replies - 1 through 2 (of 2 total)
  • I would like this too — I’m interested in limiting down the characters similar to the wordpress excerpt() function — having a ‘read more’ appear, etc.

    However, I’m not using the widget, I’m coding this straight into a template. So having the functionality, something like:

    <?php collision_testimonials(excerpt="75",$id="4"); ?>

    That would be pretty cool.

    OK, I just updated the plugin to truncate my customer quote. I didn’t add in all the fancy shmancy code like I wrote above in order to customize it, as apparently there is a new version of the plugin coming out very soon, and that would be a waste of time on my part.

    However, for anyone who wishes to make these updates, here’s what I did:

    • In the wp-admin, I clicked on the editor link under Plugins
    • I selected Collision Testimonials as the plugin from the drop down
    • I selected the first file: collision-testimonials/collision-testimonials.php
    • I added the following function at line 259, above the // Main Function Code, to be included on themes; MAKE SURE TO EDIT THE HREF TO YOUR SITE!!!:
      function shorten ($str, $len)
      {
          if (strlen($str) > $len)
          {
              return substr( $str, 0, strrpos( substr( $str, 0, $len), ' ' ) ) . '... <a href="https://www.yoursite.com/path/to/testimonials/">[read more]</a>';
          }
      	else
          {
              return $str;
          }
      }
    • I added code to shorten the $quote variable in two places. With the shorten function code added above, these were approximately lines 304 and 341. Look for the following code
      $quote = stripslashes($data['quote']);
      and add the following on a new line below:
      $quote= shorten($quote,600);
      — the 600 is the character limit after which the ‘…[read more]’ link appears. Set this to whatever you need it to be.
    • I think the widget will wind up grabbing the shortened quote, it looks like it runs that function. I don’t know, though, and I don’t plan on using the widget, so you’re on your own there.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Collision Testimonials] Widget character length and/or array of ID's’ is closed to new replies.