Title: Using short codes in PHP
Last modified: August 24, 2016

---

# Using short codes in PHP

 *  Resolved [frogza](https://wordpress.org/support/users/frogza/)
 * (@frogza)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/using-short-codes-in-php/)
 * I am trying to use short codes in a php script that pulls data from another database
   and outputs to a page on my wordpress site. The code I’m using is:
    `echo do_shortcode('[
   wp_colorbox_media url="http://..../trailers/pics/thumbs/$Name" type="image" hyperlink
   ="..../trailers/pics/$Name"]');`
 * Of course, the “….” in the code above has the actual URL for the image. What 
   I get on the page is: Please specify the URL of your media file that you wish
   to pop up in lightbox
 * for each image that should be displaying. The $Name variable isn’t being populated
   instead the exact code above is being output. Any ideas?
 * [https://wordpress.org/plugins/wp-colorbox/](https://wordpress.org/plugins/wp-colorbox/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [frogza](https://wordpress.org/support/users/frogza/)
 * (@frogza)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/using-short-codes-in-php/#post-5998403)
 * I got it, stupid mistake from being too tired. Used print instead of echo

Viewing 1 replies (of 1 total)

The topic ‘Using short codes in PHP’ is closed to new replies.

 * ![](https://ps.w.org/wp-colorbox/assets/icon-128x128.png?rev=2610062)
 * [WP Colorbox](https://wordpress.org/plugins/wp-colorbox/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-colorbox/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-colorbox/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-colorbox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-colorbox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-colorbox/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [frogza](https://wordpress.org/support/users/frogza/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/using-short-codes-in-php/#post-5998403)
 * Status: resolved