fix: Shortcodes in NextGen Descriptions, Simple PayPal Shopping Cart

NOTE: this will probably work to use shortcodes for any plugin or theme within NextGen Image Descriptions, but this does not make the shortcodes get parsed and work in the lightbox effects. Also, you’ll have to put the gallery template file somewhere where it works. I couldn’t get it to work in my theme’s folder. So this post has it in a plugin’s folder, but you may not be using that plugin (although I guess you could install it, just for the shortcode-enabling bit)

Link to modified gallery-wp-cart.php file which should be used to overwrite the version in /plugins/wordpress-simple-paypal-shopping-cart/lib/.

This was a NIGHTMARE for me to figure out. After some recent software updates, probably most notably, Nextgen Gallery’s big v2 update, my client’s descriptions disappeared from the lightbox effect.

We had things set up so that each image in a gallery represents a product.  Underneath each thumbnail in the gallery is an “add to cart” button created with WordPress Simple Paypal Shopping Cart Plugin. This was done by adding the following syntax to each image’s description in “Manage Galleries:”

Visible human-readable description is here followed by human-friendly price, followed by shortcode contained within SPAN so I could selectively hide the shorcode. $20<span class=”cart”>[(remove this)wp_cart_button name=”Product Name” price=”20.00″(remove this too)]</span>

Then with CSS, captions were hidden from thumbnail view, buttons were un-hidden and styled for thumbnail veiw, lightbox captions were styled and lightbox shortcodes (which just display as the shortcodes, a challenge I’m not up to night now) were hidden via the span.

It worked fine, but after some site maintenance, shit went crazy.  Captions disappeared.  The closest I could get to getting things back was to use “template=caption”  in a legacy Nextgen shortcode, but this did not allow the Cart Buttons to be parsed and render as buttons.

Nextgen says on their site that you can create new gallery templates by adding them to your active theme.  While this may be the case, it wasn’t working for me.

I noticed, by the way, that that span id=”lightbox-image-details-caption” now had style=”display: none; and the span that previously contained the caption was now empty :(

I think having gallery-wp-cart.php in two places (the theme and the plugin) favors the plugin over the theme.  And anyway, the file that came with WordPress Simple Paypal Shopping Cart is out of date, at least as of writing this, 2014-09-28.

So after spinning my wheels for hours and hours, I finally created a hybrid of gallery-caption.php (from nextgen) and gallery-wp-cart.php (from WordPress Simple Paypal Shopping Cart). Link is below and above (zipped file). I used this to replace the plugin’s version.  Of course, this will get overwritten when there’s an update to the plugin.

If you are going to try to use my solution, and you’re working for someone else, I recommend, at the very least editing the cart plugin’s description  to contain a warning not to auto update (in wp_shopping_cart.php).

Here’s the Gallery Template file I made.

 

 

If you found this information helpful, please consider making a donation. No amount is too small.

Bitcoin Donation Address:
1KAAN2ULpdZ2cjegDHYTXP1qXGLUybs5H6

Leave a Reply

Your email address will not be published. Required fields are marked *