Return to Snippet

Revision: 67741
at October 24, 2014 02:18 by FlashBuddy


Initial Code
/* === ORIG TESTIMONIALS 
add_shortcode('testimonial', 'et_testimonial');
function et_testimonial($atts, $content = null) {
	extract(shortcode_atts(array(
		'style' => '',
		'id' => '',
		'class' => '',
		'author' => '',
		'company' => '',
		'image' => '',
		'timthumb' => 'on'
	), $atts, 'testimonial'));

	$content = et_content_helper($content);
	$style = ( $style <> '' ) ? ' style="' . esc_attr( $style ) . '"' : '';
	$id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
	$class = ($class <> '') ? esc_attr( ' ' . $class ) : '';

	$orig_name = $author;
	$author = ( $author <> '' ) ? "<span class='t-author'>" . esc_html( $author ) . "</span>" : '';
	$company = ( $company <> '' ) ? "<span class='t-position'>" . esc_html( $company ) . "</span>" : '';

	$image_markup = '';
	if ( $image <> '' ) {
		$image = ( $timthumb == 'on' ) ? et_new_thumb_resize( $image, 60, 60, '', $forstyle = true ) : $image;
		$image_markup = "
			<div class='t-img'>
				<img src='" . esc_attr( $image ) . "' alt='" . esc_attr( $orig_name ) . "' />
				<span class='t-overlay'></span>
			</div>
		";
	}

	$output = "
		<div{$id} class='et-testimonial-box{$class}'{$style}>
			<div class='et-testimonial-author-info clearfix'>
				{$image_markup}
				{$author}
				{$company}
			</div>

			<div class='et-testimonial clearfix'>
				{$content}
			</div>

		    <div class='t-bottom-arrow'></div>
		</div>";

	return $output;
}
*/

/* === 	TESTIMONIALS ======================= */
add_shortcode('testimonial', 'et_testimonial');
function et_testimonial($atts, $content = null) {
extract(shortcode_atts(array(
'style' => '',
'id' => '',
'class' => '',
'author' => '',
'company' => '',
'image' => '',
'link' => '',
'timthumb' => 'on'
), $atts));

$content = et_content_helper($content);
$style = ( $style <> '' ) ? ' style="' . $style . '"' : '';
$id = ($id <> '') ? " id='" . esc_attr( $id ) . "'" : '';
$class = ($class <> '') ? esc_attr( ' ' . $class ) : '';

$orig_name = $author;
$author = ( $author <> '' ) ? "<span class='t-author'>{$author}</span>" : '';
$company = ( $company <> '' ) ? "<span class='t-position'><a href='{$link}' title='{$orig_name}'>{$company}</a></span>" : '';

$image_markup = '';
if ( $image <> '' ) {
$image = ( $timthumb == 'on' ) ? et_new_thumb_resize( $image, 60, 60, '', $forstyle = true ) : $image;
$image_markup = "
<div class='t-img'>
<a href='{$link}' title='{$orig_name}'><img style='z-index: 99; position: relative;' src='{$image}' alt='{$orig_name}' /></a>
<span class='t-overlay'></span>
</div>
";
}
/* === END TESTIMONIAL ================*/

Initial URL

                                

Initial Description
Enable link in Elegant Themes testimonials shortcode. Replace existing testimonial code in /et-theme-name/epanel/shortcodes.php with provided snippet. Shortcode will look like this: [testimonial link="yourlinkaddress.com" author="Author Name" company="Company Name" image="path-to-author-image"]blah blah blah[/testimonial]

Initial Title
Elegant Themes Testimonial Shortcode - Add Link to Company Name and Uuthor Image

Initial Tags

                                

Initial Language
PHP