Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function linkURLsInCustomFields($html) {
- $matches = array();
- $pattern = '#<dd.*>(https?:\\/\\/[a-zA-Z0-9-\\.]+\\.[a-zA-Z0-9-\\.]+)<\/dd>#';
- preg_match_all($pattern, $html, $matches);
- $matches = $matches[1];
- $totalMatches = count($matches);
- if ($totalMatches >= 1) {
- for ($i = 0; $i <= $totalMatches; $i++) {
- $match = $matches[$i];
- $link = '<a href="'.$match.'">'.$match.'</a>';
- $html = str_replace($match, $link, $html);
- }
- }
- return $html;
- }
- add_filter('tribe_the_custom_fields', 'linkURLsInCustomFields');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement