Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subharanjanm/af932cb8146abbca9b68427335607eb7 to your computer and use it in GitHub Desktop.
Save subharanjanm/af932cb8146abbca9b68427335607eb7 to your computer and use it in GitHub Desktop.
Link to large thumbnail image in Testimonials Widget
<?php
global $tw_template_args;
$testimonial = $tw_template_args['testimonial'];
$link_before = Axl_Testimonials_Widget_Premium::get_template_part( 'link', 'before' );
$link_after = Axl_Testimonials_Widget_Premium::get_template_part( 'link', 'after' );
if( ! empty( $testimonial['testimonial_image'] ) ) {
$large_thumb_url = '';
if ( has_post_thumbnail( $testimonial['post_id'] ) ) {
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $testimonial['post_id'] ), 'large' );
if ( ! empty( $large_image_url[0] ) ) {
$large_thumb_url = esc_url( $large_image_url[0] );
}
}
$link_before = '<a href="'. $large_thumb_url .'" title="Testimonial Image">';
}
?>
<span class="image"><?php echo $link_before . $testimonial['testimonial_image'] . $link_after; ?></span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment