Last active
May 8, 2020 05:15
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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