Created
July 16, 2021 08:14
-
-
Save plugin-republic/2780189c71934a7c0697bd1e92214be0 to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* Add link to child product name | |
* Also removes price and separator from product name | |
*/ | |
function prefix_add_link_to_child_product_name( $title, $child_product ) { | |
$title = sprintf( | |
'<a style="pointer-events: auto" href="%s" target="%s">%s</a>', | |
get_permalink( $child_product->get_id() ), | |
apply_filters( 'pewc_child_product_title_target', '_blank' ), | |
get_the_title( $child_product->get_id() ) | |
); | |
return $title; | |
} | |
add_filter( 'pewc_child_product_title', 'prefix_add_link_to_child_product_name', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment