Last active
May 9, 2018 15:20
-
-
Save badabingbreda/cbcb1eeed8ea5b5c5ef4c34e32983b91 to your computer and use it in GitHub Desktop.
Toolbox Filter Example - Highlight WYSIWYG
This file contains hidden or 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( 'toolbox/helpers/get_acf_field/type=wysiwyg' , 'highlight_amsterdam_glass', 10, 5 ); | |
function highlight_amsterdam_glass( $string, $field_object, $value, $atts, $postid ) { | |
$regex = '/((?i)\b' . 'amsterdam glass' . '\b)/m'; | |
return preg_replace( $regex , '<span style="background-color:##b2af01;color:#fff;padding-left:5px;padding-right:5px;">'.'$1'.'</span>', $string); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment