Created
January 27, 2021 19:36
-
-
Save boonebgorges/95d1ec1c291e7c63cdeb0391780b6d51 to your computer and use it in GitHub Desktop.
Modify 'Open' and 'Cloneable' badge markup for Commons In A Box OpenLab
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_filter( | |
'openlab_badges_badge_links', | |
function( $badge_links, $group_id, $context ) { | |
foreach ( $badge_links as &$link ) { | |
if ( false !== strpos( $link, '>Open<' ) ) { | |
$link = str_replace( 'href="somelink"', 'href="#"', $link ); | |
} | |
if ( false !== strpos( $link, '>Clone<' ) ) { | |
$link = str_replace( '>Clone<', '>Cloneable<', $link ); | |
} | |
} | |
return $badge_links; | |
}, | |
20, | |
3 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note, if you also want to change the default link for clone, currently someotherlink, you can add in this if statement. Note this would come after line 13 and the search is for Cloneable as Clone is changed to Cloneable in the 11–13 if statement.