i added this line but it's not work on my content pages.
it's just working on comments yet.
any mistake ?
<?php
/*
Plugin Name: Comment URL Compacter
Plugin URI: #
Description: When long URLs are left in a comment, they can break a theme and be obnoxious. This plugin shortens them so they look much nicer.
Version: 0.1
Author: Trevor Fitzgerald
Author URI: http://www.trevorfitzgerald.com/
*/
function compact_urls($link) {
if ( strlen($link) > 50 ) {
$link = preg_replace('/(https*:\/\/)*(www.)*/', '', $link);
$link = substr($link, 0, 18) . '…' . substr($link, -20);
}
return $link;
}
function compact_comment_urls($comment) {
$pattern = '/<a(.*)>(.*)<\/a>/ei';
$replace = '"<a$1>" . compact_urls("$2") . "</a>"';
$comment = preg_replace($pattern, $replace, $comment);
return $comment;
}
add_filter('comment_text', 'compact_comment_urls');
add_filter('the_content', 'compact_comment_urls');
?>