)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between $stop = count($textarr);// loop stuff for ($i = 0; $i < $stop; $i++) { $content = $textarr[$i]; if ((strlen($content) > 0) && ('<' != $content{0})) { // If it's not a tag $pos = strpos($content, ':dynamic:http'); if(!($pos === false)) { $content = str_replace(':dynamic:http', ":dynamic:", $content); $content = str_replace('gif :end:', "gif' alt=':dynamic:' class='wp-smiley' />", $content); $content = str_replace('jpg :end:', "jpg' alt=':dynamic:' class='wp-smiley' />", $content); $content = str_replace('jpg:end:', "jpg' alt=':dynamic:' class='wp-smiley' />", $content); } } $output .= $content; } } else { // return default text. $output = $text; } return $output; } add_filter('comment_text', 'convert_web_smilies', 20); add_filter('the_content', 'convert_web_smilies'); add_filter('the_excerpt', 'convert_web_smilies'); ?>