WordPress: WP Supersized + NextGEN Gallery – fix for description field

2013-01-21 WordPress

WP Supersized allows You to enjoy full-sized background pictures on Your website. Unfortunately, if You will like to combine this feature with the NextGEN Gallery's HTML description of each picture (typed into NextGEN description textarea filed), in one specific case the script may break the whole site. It can occur when You will type new line character simply by pressing "enter" on keyboard. New line symbol:

\n

destroys the JS code, responsible for proper work of WP Supersized plugin. If You won't remove new line character, page with assigned "supersized" background, will not appear. Simple fix, presented below will remove invalid characters and will clean You descripton content.

Find file called WPSupersized.php in:

/wp-content/plugins/wp-supersized/includes

Near line 930 try to find:

if ($ngggallery_caption == '')
   $ngggallery_caption = $ngggallery_title; // if there is no caption, use title instead

After this line add:

$ngggallery_caption = str_replace(array("\r", "\r\n", "\n"), '', $ngggallery_caption);

From now You can paste many HTML tags into description fields.