Foliovision › Forums › FV Testimonials › How to … › Can a testimonial be embedded into a widget?
-
-
Hi Andrew,
at the moment you can insert testimonials either directly into the template or into the PHP widget. You need to use following code:
<?php echo apply_filters('the_content', '[Testimonials: all]'); ?>
Adjust the properties for testimonials to be displayed as you wish.
We are planning to release a new version of testimonials plugin where this issue will be fixed and the shortcode will work in normal Text widget as well. Until then this workaround works.
Hope this helps,
ZdenkaHi Andrew,
since you have the pro version, the easiest way for you to fully customise the testimonials output is to create a template for it, and them use this template in the shortcode. Advantage of templates is that you can adjust html just as you need. Here’s guide to templates which might help you to get started.
The very basic template could be just
[title ,]
[excerpt]But I suggest you to check the range of other tags that can be used and fill out the html as well.
Zdenka
I have implemented template in the pro version of testimonials. I have one template that is working fine and another that does not change the style of the content on the testimonials page.
My template contents is:
<p style=”font-size:18px; color:#3366CC; font-family:arial”> [title] </p><p style=”font-size:12px; color:#404040; font-family:arial”>[content]</p>The call to the fvtestimonials content in the page is:
[Testimonials: -t 2 all]the page in question can be viewed at:
“http://www.corepractice.com.php5-20.dfw1-1.websitetestlink.com/testimonials”I have “output default css” and “use texy” – unchecked in the options.
what do I need to do to have the template affect all the page contents the same way?
Thanks,
AndrewHi Andrew,
When looking into the source code of your testimonials page it seems that the heading p tag is styled, but the content one isn’t. To me this looks like your actual ‘content’ of the testimonial already contains a p tag which causes closure of the above one. Can you please check in your testimonials, their content? Are you using p tags there?
To avoid this I would suggest changing the p tag in your template for div for example, with the same styling.
Hope this helps,
ZdenkaHi Lisa,
we are planning a brand new release of testimonials plugin, as well as their pro version. It will come out in May.
The new version will have shortcodes that can be used within normal text widgets.
Thanks for this suggestion to create a dedicated widget, we will certainly consider this in this or in one of the next releases!
Guide to templates is here, and at the very end of the article there’s an example of simple template, which you can start with.Thank you,
ZdenkaI still can’t seem to get the random testimonial to work in my widget. I have the PRO version. Here is my widget code:
<h4>[title]</h4><p>[content]</p><p>Read more</p>
Here is my code I am using in my PHP widget:
<div id=”testimonial-widget”><?php echo apply_filters(‘the_content’, ‘[Testimonials: -c1 -t1 ]’); ?></div>
Hello Kriselle,
yes the code you’re using is displaying only the top most approved testimonial. You should use some of the built functions. Here is a sample code that displays random testimonials. It can be inserted into PHP widget.
<?php fpt_get_testimonials( array( 'where' => array( 'status' => 'approved' ), 'order' => array( 'rand()' => 'ASC' ), 'limit' => 1 ), true, 1 ); ?>
It echos the result automatically. The last 1 in the code is for template number, you can change it to your convenience.But be aware that this may be a little slow since using MySQL rand() for sorting is highly ineffective. If you have only like few hundreds of testimonials it should be fine.
Best regards,
Peter