Title: PHP code instaid of shortcode
Last modified: August 21, 2016

---

# PHP code instaid of shortcode

 *  Resolved [Víctor](https://wordpress.org/support/users/njusted/)
 * (@njusted)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/php-code-instaid-of-shortcode/)
 * Hi! First of all, congratulations for this awesome plugin!
 * I have a small problem… when I try to put the php code instaid the shortcode 
   in my theme, it fails and show up nothing. This is the code i used:
 * `<?php echo do_shortcode('[mycred_sell_this price="10" button_label="Desbloquear"
   expire="24"]'.$enlaces=get_post_meta($post->ID, 'wpcf_enlaces', true).'[/mycred_sell_this]');?
   >`
 * I read wordpress codex, but I think is a problem calling a custom field. Any 
   solution?
 * Thank you 🙂
 * [http://wordpress.org/plugins/mycred/](http://wordpress.org/plugins/mycred/)

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

 *  Thread Starter [Víctor](https://wordpress.org/support/users/njusted/)
 * (@njusted)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/php-code-instaid-of-shortcode/#post-4093740)
 * Solved… it’s: $enlaces=get_post_meta($post->ID, ‘wpcf**–**enlaces’, true).
 *  Thread Starter [Víctor](https://wordpress.org/support/users/njusted/)
 * (@njusted)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/php-code-instaid-of-shortcode/#post-4093742)
 * Now, the content of $enlaces it’s unformatted and don’t have `<br>` (sorry for
   my english, i can’t speak very well). What can I do?
 *  Plugin Author [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/php-code-instaid-of-shortcode/#post-4093759)
 * I would call the $enlaces first and format it according to your needs, then include
   it in the shortcode.
 *     ```
       $enlaces = get_post_meta($post->ID, 'wpcf_enlaces', true);
       $enlaces = nl2br( $enlaces );
       echo do_shortcode('[mycred_sell_this price="10" button_label="Desbloquear" expire="24"]' . $enlaces . '[/mycred_sell_this]' );
       ```
   
 * _P.S. Make sure you wrap code you insert here by selecting the entire code snippet
   and clicking on the “code” button above the textarea. This way it will be formatted
   properly._
 *  Thread Starter [Víctor](https://wordpress.org/support/users/njusted/)
 * (@njusted)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/php-code-instaid-of-shortcode/#post-4093849)
 * You’re a master! Thanks for this great support.

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

The topic ‘PHP code instaid of shortcode’ is closed to new replies.

 * ![](https://ps.w.org/mycred/assets/icon-128x128.gif?rev=3512531)
 * [Points Management System For Gamification, Ranks, Badges, and Loyalty Rewards Program - myCred](https://wordpress.org/plugins/mycred/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mycred/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mycred/)
 * [Active Topics](https://wordpress.org/support/plugin/mycred/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mycred/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mycred/reviews/)

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)
 * [php code](https://wordpress.org/support/topic-tag/php-code/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 4 replies
 * 2 participants
 * Last reply from: [Víctor](https://wordpress.org/support/users/njusted/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/php-code-instaid-of-shortcode/#post-4093849)
 * Status: resolved