Advertisement
acegiak

Untitled

Jun 20th, 2013
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. //attaches in-reply-to classes to the first link in the post
  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' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement