Force Captions to Have Line Breaks - Aaron Meyers

Force Captions to Have Line Breaks

Legacy SmugMug and the New SmugMug handle line-breaks in the photo caption very differently. Legacy SmugMug was "smart" -- it would automatically add HTML "
" commands whenever there was a line break (hit the return/enter key). Even if HTML was detected, it would still automatically add
's for you. The New SmugMug is less smart: it will automatically add
's but only if there is no HTML added. The second it sees HTML it assumes you have entered the
's yourself. For those of you that created captions in the Legacy SmugMug without
's, or those of you who create captions in Lightroom/Adobe Bridge/Aperture, you don't want to have to add
's to all of your captions. The following code automatically adds line-breaks. If you enter:

The quick brown fox

jumped over the fence.
The New SmugMug would display it as:
The quick brown fox jumped over the fence.
Using the following code, it will display as you entered it, with the line breaks: Add the following CSS to your theme's Advanced CSS settings:
/* Force linebreaks to have a break */
.sm-gallery-image-container .sm-tile-info, .sm-lightbox-caption,
.sm-gallery-images .sm-tile-info, .sm-lightbox-caption {
  white-space: pre-wrap;
}

/* Disable all BR tags */
.sm-gallery-image-container .sm-tile-info br, .sm-lightbox-caption br,
.sm-gallery-images .sm-tile-info br, .sm-lightbox-caption br {
  display: none;
}

Comments

Powered by SmugMug Log In