Title: Turning Php Code Into Shortcode (?)
Last modified: November 23, 2017

---

# Turning Php Code Into Shortcode (?)

 *  [XLFR](https://wordpress.org/support/users/xlfr/)
 * (@xlfr)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/turning-php-code-into-shortcode/)
 * Hello, I have the following code:
 *     ```
       <?php
       echo '<iframe src="https://www.e-junkie.com/ecom/rp.php?noredirect=true&client_id=CID&txn_id=' . htmlspecialchars($_GET["txn_id"]) . '" style="width:100%;border:0;min-height:500px;"></iframe>';
       ?>
       ```
   
 * And I need to turn it into shortcode to implement it into a specific page.
    I
   tried reading online but didn’t find a clear answer. Can someone please help 
   me? Thanks.

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

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [8 years, 4 months ago](https://wordpress.org/support/topic/turning-php-code-into-shortcode/#post-9715745)
 * Always that exact string or would something vary from use to use?
 *  Thread Starter [XLFR](https://wordpress.org/support/users/xlfr/)
 * (@xlfr)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/turning-php-code-into-shortcode/#post-9715818)
 * That one exactly.
    Thanks.
 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [8 years, 4 months ago](https://wordpress.org/support/topic/turning-php-code-into-shortcode/#post-9715895)
 *     ```
       function my_junkie_shortcode( $atts, $content) {
         return '<iframe src="https://www.e-junkie.com/ecom/rp.php?noredirect=true&client_id=CID&txn_id=' . htmlspecialchars($_GET["txn_id"]) . '" style="width:100%;border:0;min-height:500px;"></iframe>';
          }
       add_shortcode( 'junkie', 'my_junkie_shortcode' );
       ```
   
 * Put that in your theme’s functions.php or create a simple plugin ([example](https://github.com/sterndata/sdsplugin))
   for it.
 * To use it, just put `[junkie]` in the content.
 *  Thread Starter [XLFR](https://wordpress.org/support/users/xlfr/)
 * (@xlfr)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/turning-php-code-into-shortcode/#post-9736404)
 * Steve, you’re the man! Thanks a lot!

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

The topic ‘Turning Php Code Into Shortcode (?)’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 4 replies
 * 2 participants
 * Last reply from: [XLFR](https://wordpress.org/support/users/xlfr/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/turning-php-code-into-shortcode/#post-9736404)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
