Viewing 1 replies (of 1 total)
  • RayZorJ3lade

    (@rayzorj3lade)

    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("https://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("https://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');
Viewing 1 replies (of 1 total)
  • The topic ‘Display all testimonials?’ is closed to new replies.