Title: Using shortcodes within nextgen description
Last modified: December 21, 2017

---

# Using shortcodes within nextgen description

 *  Resolved [titchpitch](https://wordpress.org/support/users/titchpitch/)
 * (@titchpitch)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/using-shortcodes-within-nextgen-description/)
 * Hi,
 * I am trying to use a custom shortcode (the groups plugin) to show some specific
   content in the image description but I cannot get shortcodes to work.
 * Anyone had any luck with this or no how to do?
 * I am trying to add into the nextgen gallery download template.
 * this is the code ive tried:
    `<?php echo do_shortcode( "$image->description" )?
   >`
 * part of this wider code:
    `<label><div class="tooltip"><span class="fa-stack 
   fa-lg priceicon"><i class="fa fa-circle fa-stack-2x priceiconbottom" ></i><i 
   class="fa fa-dollar fa-inverse fa-stack-1x priceicontop" ></i></span><span class
   ="tooltiptext"><?php echo do_shortcode( "$image->description" ) ?></span></div
   ><a href="<?php echo $image->imageURL ?>" download><i class="fa fa-download singleimgdownload"
   ></i></a><input type="checkbox" name="pid[]" class="imagecheckbox" value="<?php
   echo $image->pid ?>" /></label>`
 * Thanks
    -  This topic was modified 8 years, 4 months ago by [titchpitch](https://wordpress.org/support/users/titchpitch/).
    -  This topic was modified 8 years, 4 months ago by [titchpitch](https://wordpress.org/support/users/titchpitch/).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [Imagely](https://wordpress.org/support/users/imagely/)
 * (@imagely)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/using-shortcodes-within-nextgen-description/#post-9803793)
 * [@titchpitch](https://wordpress.org/support/users/titchpitch/) – The `do_shortcode()`
   function requires the actual shortcode so it can be parsed and rendered; it does
   not take a variable as is.
 * Please see [https://developer.wordpress.org/reference/functions/do_shortcode/](https://developer.wordpress.org/reference/functions/do_shortcode/)
 * Thanks!
 * – Cais.
 *  Thread Starter [titchpitch](https://wordpress.org/support/users/titchpitch/)
 * (@titchpitch)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/using-shortcodes-within-nextgen-description/#post-9804941)
 * Hi Cais
 * Thanks for replying.
 * I cant figure out how to parse or render the variable. (even if i put in a shortcode
   to test instead of a $variable it still prints the string)
 * Any ideas how I can either get the variable (aka description) parsed, or to natively
   allow shortcodes to be rendered within the description itself?
 * Thanks 🙂
 *  Plugin Contributor [Imagely](https://wordpress.org/support/users/imagely/)
 * (@imagely)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/using-shortcodes-within-nextgen-description/#post-9818061)
 * [@titchpitch](https://wordpress.org/support/users/titchpitch/) – Parsing a shortcode
   within a shortcode within `do_shortcode()` is getting beyond the scope of support
   for our plugin specifically.
 * I would suggest looking at how one might parse the “description” shortcode and
   then add that as needed to an appropriate parameter (if possible).
 * Thanks!
 * – Cais.
 *  Thread Starter [titchpitch](https://wordpress.org/support/users/titchpitch/)
 * (@titchpitch)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-shortcodes-within-nextgen-description/#post-9867986)
 * Thought id leave an update on what I ended up doing.
 * I decided to turn the description box into an array in a custom template determining
   the split using a commar.
 * `$pricearray = explode(',', $image->description);`
 * and then used a switch statement to display the right part of the array:
 *     ```
       switch ($userCountry) {
       case "UK":
       	$desc = '£' . $pricearray[0];
       	break;	
       case "Singapore":
       	$desc = 'S$' . $pricearray[1];
       	break;
       case "US":
       	$desc = 'US$' . $pricearray[2];
       	break;
       default;
       	$desc = 'Unavailable';
       ```
   
 * finally adding this into title tag:
    `<?php esc_attr($desc) ?>`
 * Maybe this will help someone in the future as possible way to go. Could also 
   use this method of creating an array to make a kind of additional field.
    -  This reply was modified 8 years, 3 months ago by [titchpitch](https://wordpress.org/support/users/titchpitch/).
    -  This reply was modified 8 years, 3 months ago by [titchpitch](https://wordpress.org/support/users/titchpitch/).
    -  This reply was modified 8 years, 3 months ago by [titchpitch](https://wordpress.org/support/users/titchpitch/).
 *  Plugin Contributor [Imagely](https://wordpress.org/support/users/imagely/)
 * (@imagely)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/using-shortcodes-within-nextgen-description/#post-9874504)
 * [@titchpitch](https://wordpress.org/support/users/titchpitch/) – Thanks for sharing!
 * – Cais.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Using shortcodes within nextgen description’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

## Tags

 * [nextgen](https://wordpress.org/support/topic-tag/nextgen/)

 * 5 replies
 * 2 participants
 * Last reply from: [Imagely](https://wordpress.org/support/users/imagely/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/using-shortcodes-within-nextgen-description/#post-9874504)
 * Status: resolved