Title: Multiple PHP snippets not working
Last modified: September 29, 2020

---

# Multiple PHP snippets not working

 *  [wp800s](https://wordpress.org/support/users/wp800s/)
 * (@wp800s)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multiple-snippets-not-working/)
 * Hi,
 * I have PHP snippets like this:
 *     ```
       include get_stylesheet_directory() . '/inc/prices.php';
       echo getMoneyUS($us21);
       ```
   
 * It shows the price that is listed in prices.php. Having a single snippet on a
   page works fine. Having a second snippet with the same code, just a different
   price call, either breaks the page, or it shows $0.00 for the second one. The
   break happens if I use INCLUDE in both snippets. Using INCLUDE_ONCE or no INCLUDE
   at all in the second one produces $0.00.
    This code works fine in my static HTML
   pages. Now, seeing $0.00 tells me that my monetary function works fine, but why
   the code in the snippet does not read the prices.php for the second one, that
   is something I cannot figure. The variable is there. Plus, the first price is
   shown correctly.
 * Thanks
    -  This topic was modified 5 years, 6 months ago by [wp800s](https://wordpress.org/support/users/wp800s/).
    -  This topic was modified 5 years, 6 months ago by [wp800s](https://wordpress.org/support/users/wp800s/).

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

 *  [Temyk](https://wordpress.org/support/users/webtemyk/)
 * (@webtemyk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multiple-snippets-not-working/#post-13471977)
 * Hello.
 * If you use the snippet several times on the same page, you need to use **include_once**,
   otherwise there will be errors.
    The rest of the problem is in your code. The
   snippet only executes the code.
 *  Thread Starter [wp800s](https://wordpress.org/support/users/wp800s/)
 * (@wp800s)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multiple-snippets-not-working/#post-13480285)
 * Thank you. Makes sense. But it is puzzling for me why I get those zeros after
   first value was presented correctly. Using the same code in my static HTML pages
   works just fine. :/
    Anyhow, thank you for clarification.
 *  [Temyk](https://wordpress.org/support/users/webtemyk/)
 * (@webtemyk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/multiple-snippets-not-working/#post-13482124)
 * I haven’t seen your code, so I can’t tell you.

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

The topic ‘Multiple PHP snippets not working’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3475630)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Temyk](https://wordpress.org/support/users/webtemyk/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/multiple-snippets-not-working/#post-13482124)
 * Status: not resolved