WordPress.org

Ready to get started?Download WordPress

Forums

Testimonials Pro
Display all testimonials? (2 posts)

  1. toddheitner
    Member
    Posted 1 year ago #

    Is there a way to display all the testimonials on a page? There is an option for linking to more testimonials, so ideally the plugin would allow for outputting all the testimonials to a page via shortcode.

    http://wordpress.org/extend/plugins/testimonials-pro/

  2. RayZorJ3lade
    Member
    Posted 1 year ago #

    I wrote my own shortcode - add this code to functions.php and then use the shortcode [all_testimonials]

    /* Show All Testimonials */
    
    function all_testimonials() {
    	global $wpdb;
    	$testimonials = $wpdb->get_results( "SELECT * FROM wp_testimonials_pro ORDER BY TP_id DESC" );
    	$return = '<style type="text/css">';
    	$return .= '.TP-regimage img {';
    	$return .= '	float: right;';
    	$return .= '	vertical-align:bottom;';
    	$return .= '	padding: 3px;';
    	$return .= '}';
    	$return .= '.TP_navigation {height:20px; width:45px; float:left; }';
    	$return .= '.TP_prev, .TP_next { background:url("http://www.leco.co.uk/wp-content/plugins/testimonials-pro/navigation-20px.png"); width:20px; height:20px; float:left; cursor:pointer; } ';
    	$return .= '.TP_next {background-position:20px 0 !important; margin-left:5px; }';
    	$return .= '.tp-arrow {background:url("http://www.leco.co.uk/wp-content/plugins/testimonials-pro/tp-arrow.png"); width:20px; height:10px; display:block; position:absolute; bottom:-10px; left:20px; }';
    	$return .= '</style>';
    	$return .= '<div style="text-align:left;vertical-align:middle;text-decoration: none;overflow: hidden; position: relative; margin-left: 3px; " id="TPHolder">';
    	foreach($testimonials as $testimonial)
    	{
    		$return .= '<div class="TP_div" id="TP_div_1" style="opacity:1;display:inherit; padding:1px 0px 1px 0px;"><div style="padding:7px; margin-bottom:17px; border:1px solid #CCCCCC; position:relative;">';
    		$return .= $testimonial->TP_desc . '<span class="tp-arrow"></span>';
    		$return .= '</div><div class="TP-regimage"><a href="' . $testimonial->TP_link . '" target="_blank"><img src="' . $testimonial->TP_path . '" alt="' . $testimonial->TP_name . '" /></a></div>';
    		$return .= '<div style="padding-top:7px;"><strong><a href="' . $testimonial->TP_link . '" target="_blank">' . $testimonial->TP_name . '</a></strong></div></div><p style="clear:right;">&nbsp;</p>';
    	}
    	$return .= '</div>';
    
    	return $return;
    }
    
    add_shortcode('all_testimonials', 'all_testimonials');

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.