SHOW:
|
|
- or go back to the newest paste.
| 1 | ||
| 2 | //attaches in-reply-to classes to the first link in the post | |
| 3 | - | return preg_replace('`\<[aA] (.*?)>(.*?)\@(.*?)</[aA]>`','<a class="u-in-reply-to" rel="in-reply-to" $1>$2@$3</a>',$content,1);
|
| 3 | + | |
| 4 | function the_content_in_reply_to_callback($matches){
| |
| 5 | if(preg_match('`href=.mailto`i',$matches[0])){
| |
| 6 | return $matches[0]; | |
| 7 | }else{
| |
| 8 | return '<a class="u-in-reply-to" rel="in-reply-to" '.$matches[1].'>'.$matches[2].'@'.$matches[3].'</a>'; | |
| 9 | } | |
| 10 | } | |
| 11 | function the_content_in_reply_to_filter($content) {
| |
| 12 | return preg_replace_callback('`\<[aA] (.*?)>(.*?)\@(.*?)</[aA]>`','the_content_in_reply_to_callback',$content,1);
| |
| 13 | } | |
| 14 | ||
| 15 | add_filter( 'the_content', 'the_content_in_reply_to_filter' ); |