30. September 2011
von Blackbam
Recently we had an issue with the line-breaks in WordPress comments - the comments are saved to the database as they are submitted from the textarea in your theme, and depending on the theme so they are displayed. If your comments are displayed as HTML and there is no mechanism to add line breaks anywhere, then the comments do not have any line-breaks (as HTML line breaks must be created with a br-tag or something similar).   Another anoying thing is when commenters do not make links to hyperlinks, as these are not linked and clickable afterwards. We have found a solution for these problem - just copy the following script to your functions.php-file and your comments will be sanitized:  
function format_the_comment_html($comment_data) {
	return $comment_data;
function makeClickableLinks($text) {
	$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\', $text);
	$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\', $text);
	$text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','\', $text);
	return $text;

Dieser Eintrag wurde am 30. September 2011 um 14:14 in der Kategorie WordPress, WP Scripts veröffentlicht. You can book the comments for this article RSS 2.0. Feedback, discussion, commendation and critics are welcome: Write a comment or trackback.

Tags: , , ,

Warning: Use of undefined constant Ext_related_links - assumed 'Ext_related_links' (this will throw an Error in a future version of PHP) in /home/.sites/609/site1266/web/blackbams-blog/wp-content/themes/SilentWoodsByBlackbam/single.php on line 75

No comments yet

Kommentare abonnieren (RSS) or URL Trackback

Leave a comment: