Title: Tricky PHP
Last modified: August 21, 2016

---

# Tricky PHP

 *  Resolved [estr](https://wordpress.org/support/users/estr/)
 * (@estr)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/tricky-php/)
 * Hello,
 * I have created the following PHP snippets:
 * [snip1] = <?php if (is_single()) { ?>
    [snip2] = <?php } ?>
 * And put the following into a post:
 * [snip1]
    <p>Don’t display this at home/front.</p> [snip2]
 * But apparently this does not work.
 * The text inside <p></p> is different for each post, so ultimately I would like
   to edit it in a post itself, rather then creating a unique snippet for each post.
 * Could this be achieved?
 * Thank you!
 * [http://wordpress.org/plugins/post-snippets/](http://wordpress.org/plugins/post-snippets/)

Viewing 1 replies (of 1 total)

 *  [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * (@artstorm)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/tricky-php/#post-4103320)
 * Hi,
 * A shortcode is evaluated per shortcode, so spreading a condition over two shortcodes
   wont work. But you can probably achive what you want using one shortcode php 
   snippet and the content variable available for snippets:
 * snippet:
 *     ```
       if (is_single()) {
       echo "{content}";
       }
       ```
   
 * WordPress Post
 *     ```
       [snippet}
       Lorem Ipsum
       [/snippet]
       ```
   
 * Cheers,
    Johan

Viewing 1 replies (of 1 total)

The topic ‘Tricky PHP’ is closed to new replies.

 * ![](https://ps.w.org/post-snippets/assets/icon-128x128.gif?rev=2545587)
 * [Post Snippets - Custom WordPress Code Snippets Customizer](https://wordpress.org/plugins/post-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/post-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-snippets/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Johan Steen](https://wordpress.org/support/users/artstorm/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/tricky-php/#post-4103320)
 * Status: resolved