Does anybody have an idea how to add testimonials with an image in WordPress? Is there is any plugin that fulfills my requirement? I searched but did not find any. It must support PHP version 4.4.9.
2 Answers
Make a new category called Testimonials then, in your theme folder add a new file called testimonials.php.
Add this in the newly created file:
<div id="testimonials">
<?php $args = array('caller_get_posts' => 1, 'post_type' => 'testimonials', 'post_status' => 'publish', 'posts_per_page' => 5);
query_posts($args);
if (have_posts()) : while (have_posts()) : the_post();
$image = get_post_meta($post->ID, 'testimonial-image', true);
?>
<div class="testimonail">
<img src="<?php echo $image; ?>" width="" height="" alt="<?php the_title(); ?>" />
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
</div>
<?php endwhile; else : endif; ?>
</div>
Then add where do you want the testimonials to show. Example footer.php
Now you can add testimonials by simply adding a new post and fill it under the Testimonials category. As for the image, make a new custom field called testimonial-image and for the value add the path to the image (ex: http://example.com/image.png).
And you are good to go.
-
Thanks for Reply,But I want to manage this testimonial separate from post.– shaluDec 1, 2010 at 7:59
-
Then install wordpress.org/extend/plugins/custom-post-type-ui and add a new custom post type called Testimonials. Then use my code.– Vlad.PDec 1, 2010 at 8:04
-
Hello thanks for reply I have created testimonial custom post type but i also need to show image for each testimonials.From this custom post type i m just able to insert title and content from where we can insert image .please let me know its very urgent– shaluDec 3, 2010 at 6:02
-
make a new custom field called testimonial-image and for the value add the path to the image (ex: example.com/image.png).– Vlad.PDec 3, 2010 at 6:24
-
OK Thanks sir but my problem resolved .I have managed this through featured image.Thanks– shaluDec 3, 2010 at 7:42
This plugin will do everything you need and a whole lot more: http://wordpress.org/extend/plugins/tb-testimonials/