Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rjfrizz/a4ec4df41b49dc398747731d14adf63f to your computer and use it in GitHub Desktop.
Save rjfrizz/a4ec4df41b49dc398747731d14adf63f to your computer and use it in GitHub Desktop.
replaces the review widget title with an attachment image if one is provided
/**
* Replace contribution titles with the contribution image
*
* NOTE: requires version higher than 1.6.3 to use this filter
*
* @param string $title the contribution title
* @param \WC_Contribution $contribution the contribution object with comment data
* @return string - updated title
*/
function sv_wc_prp_replace_widget_contribution_title( $title, $contribution ) {
echo '<img src="'. $contribution->get_attachment_url() .'">';
}
add_filter( 'wc_product_reviews_pro_widget_contribution_title', 'sv_wc_prp_replace_widget_contribution_title', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment