Title: Potentially quick question using do_shortcode()&#8230;
Last modified: August 20, 2016

---

# Potentially quick question using do_shortcode()…

 *  [bfeely](https://wordpress.org/support/users/bfeely/)
 * (@bfeely)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/potentially-quick-question-using-do_shortcode/)
 * Hello,
 * I’m not fairly knowledgeable with PHP, but hopefully somebody can help me with
   a little problem I’m having…
 * So, I’m trying to add a shortcode after _each_ post (this is the WP Paypal Shopping
   cart plugin) `[wp_cart:PRODUCT-NAME:price:PRODUCT-PRICE:end]`.
 * I’ve played around with the `<?php do_shortcode(); ?>`, which I believe is the
   right tool to use. So I simply add `<?php do_shortcode('[wp_cart:PRODUCT-NAME:
   price:PRODUCT-PRICE:end]'); ?>`.
 * In place of `PRODUCT-NAME`, I want to insert the title of the post/product, `
   <?php the_title(); ?>`, and in place of `PRODUCT-PRICE`, the custom field `<?
   php meta('price'); ?>`.
 * Putting `<?php do_shortcode('[wp_cart:<?php the_title(); ?>:price:<?php meta('
   price'); ?>:end]'); ?>` isn’t working, which makes sense I think because I have
   a `<?php` inside another `<?php`. My “simple” question is how to get the values
   of `<?php the_title(); ?>` and `<?php meta('price'); ?>` inside the shortcode
   to work correctly, if this is possible.
 * Sorry for rambling… Any help would be greatly appreciated! 🙂

Viewing 1 replies (of 1 total)

 *  [Alex](https://wordpress.org/support/users/netxm/)
 * (@netxm)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/potentially-quick-question-using-do_shortcode/#post-2216268)
 * you should run this shortcode inside a loop, only then you will get title and
   price of the current post. Also this plugin should have template functions which
   are much better if you inside your template files

Viewing 1 replies (of 1 total)

The topic ‘Potentially quick question using do_shortcode()…’ is closed to new replies.

## Tags

 * [do_shortcode](https://wordpress.org/support/topic-tag/do_shortcode/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [WP Shopping Cart](https://wordpress.org/support/topic-tag/wp-shopping-cart/)

 * 1 reply
 * 2 participants
 * Last reply from: [Alex](https://wordpress.org/support/users/netxm/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/potentially-quick-question-using-do_shortcode/#post-2216268)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
