Title: ACF code inside another shortcode?
Last modified: August 30, 2016

---

# ACF code inside another shortcode?

 *  [bearvv](https://wordpress.org/support/users/bearvv/)
 * (@bearvv)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/acf-code-inside-another-shortcode/)
 * I am currently using the following code in my post without problem, but I want
   to put the code in a theme and it seems it’s not working. Does any body know 
   is there anything wrong? Thanks.
 * `[coupon title="<?php echo get_the_title(); ?>" url="<?php the_field('coupon_destination_url');?
   >" code="<?php the_field('coupon_code'); ?>" image="http://123.com/123.jpg" button
   ="some text" description="<?php the_field('coupon_description'); ?>"]`
 * [https://wordpress.org/plugins/advanced-custom-fields/](https://wordpress.org/plugins/advanced-custom-fields/)

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

 *  [WADSpot](https://wordpress.org/support/users/spotoremor/)
 * (@spotoremor)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/acf-code-inside-another-shortcode/#post-6223549)
 * hi, when you say “theme” im assuming you’re referring to theme “template” (eg
   page.php).
 * try putting it inside your template file this way:
 *     ```
       echo do_shortcode('[coupon title="'.get_the_title().'" url="'. the_field('coupon_destination_url').'" code="'.the_field('coupon_code').'" image="http://123.com/123.jpg" button="some text" description="'.the_field('coupon_description').'"]');
       ```
   
 *  Anonymous User 13176105
 * (@anonymized-13176105)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/acf-code-inside-another-shortcode/#post-6223554)
 * I’m also keen to find out how to do this; not inside the theme template, but 
   as per the original post, inside the actual content area for a page. Does anyone
   know if this is possible?

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

The topic ‘ACF code inside another shortcode?’ is closed to new replies.

 * ![](https://ps.w.org/advanced-custom-fields/assets/icon.svg?rev=3207824)
 * [Advanced Custom Fields (ACF®)](https://wordpress.org/plugins/advanced-custom-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: Anonymous User 13176105
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/acf-code-inside-another-shortcode/#post-6223554)
 * Status: not resolved