Title: Manually specified HTML between PHP
Last modified: August 21, 2016

---

# Manually specified HTML between PHP

 *  Resolved [estr](https://wordpress.org/support/users/estr/)
 * (@estr)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/manually-specified-html-between-php/)
 * Hello,
 * I have the following code:
 * ————-
    <?php if (is_single()) { ?>
 * <p>Some text.</p>
 * <?php } ?>
    ————-
 * I have tried to put the following in a post:
 * ————-
    [insert_php] if (is_single()) { [/insert_php]
 * <p>Some text.</p>
 * [insert_php] } [/insert_php]
    ————-
 * But it does not work the way that it should. “Some text.” is displayed on both
   in the post, as well as on the front page, which should not be the case.
 * Could you please assist with this?
 * Thank you!
 * [http://wordpress.org/plugins/insert-php/](http://wordpress.org/plugins/insert-php/)

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

 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/manually-specified-html-between-php/#post-4101195)
 * estr, each [insert_php]…[/insert_php] block of code needs to be complete. Complete
   being that it will run independently.
 * `[insert_php]if(is_single()){[/insert_php]`
 * won’t run by itself.
 * Insert PHP works by putting the code found between the [insert_php] [/insert_php]
   tags into an eval() function. The code in the eval() function won’t reference
   PHP code outside the function.
 * This will work:
 *     ```
       [insert_php]
       function is_single() { return true; }
       if (is_single()) {
       echo '<p>Some text.</p>';
       }
       [/insert_php]
       ```
   
 * But it won’t work if it’s broken up into separate [insert_php]…[/insert_php] 
   chunks.
 * Will
 *  Thread Starter [estr](https://wordpress.org/support/users/estr/)
 * (@estr)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/manually-specified-html-between-php/#post-4101205)
 * Thank you!

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

The topic ‘Manually specified HTML between PHP’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3523853)
 * [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/)

 * 2 replies
 * 2 participants
 * Last reply from: [estr](https://wordpress.org/support/users/estr/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/manually-specified-html-between-php/#post-4101205)
 * Status: resolved