Enable prettyPhoto Lightboxes from Woocommerce to the whole WordPress site

Woocommerce is a popular e-commerce plugin for WordPress. It has a prettyPhoto excellent lightbox option for products display. Remember to enable lightbox option for products display in woocommerce plugin settings, otherwise it will not work. When you want to enable that lightbox all over your wordpress site, just add the following code to your child theme functions.php

The code will enable updated woocommerce prettyPhoto scripts and CSS throughout your site. So you’ll not need any additional plugins, and lightboxes will have the same consistent style on all of your pages.

To use prettyPhoto lightbox on CMS pages, posts or widgets, just add rel="prettyPhoto" to a link code pointing to full image version. There are more options: to display a title in your lightbox add ligthtbox’s title into the ALT attribute of your thumbnail image. To display a description in your lightbox add that description into the TITLE attribute of your link.

Important Update for WooCommerce 2.1.2!

Newest woocommerce and prettyPhoto now use data-rel="prettyPhoto" instead of just rel. To add rel=prettyPhoto to all images we can use this part of code in functions.php