Title: Allow PHP
Last modified: December 16, 2017

---

# Allow PHP

 *  Resolved [autox420](https://wordpress.org/support/users/autox420/)
 * (@autox420)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/)
 * How can i allow PHP code in the div? I have tryed most php plugins.
    -  This topic was modified 8 years, 6 months ago by [autox420](https://wordpress.org/support/users/autox420/).

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/topic/allow-php/page/2/?output_format=md) [→](https://wordpress.org/support/topic/allow-php/page/2/?output_format=md)

 *  Plugin Author [PluginlySpeaking](https://wordpress.org/support/users/pluginlyspeaking/)
 * (@pluginlyspeaking)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9637926)
 * Hi,
 * It isn’t possible currently, the php code is immediately commented by WP.
 * <?php echo “Today is ” . date(“d/m/Y”); ?>
 * becomes
 * <!–?php echo “Today is ” . date(“d/m/Y”); ?–>
 * I will take a look if I can find a way to allow PHP code in the WP textarea and
   come back to you.
 * Sorry for the inconvenience,
 * Best Regards,
    PluginlySpeaking
 *  Thread Starter [autox420](https://wordpress.org/support/users/autox420/)
 * (@autox420)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9638269)
 * Sh*t little bit disapointed. Hope you will make it possible.
    -  This reply was modified 8 years, 6 months ago by [autox420](https://wordpress.org/support/users/autox420/).
 *  Thread Starter [autox420](https://wordpress.org/support/users/autox420/)
 * (@autox420)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9638663)
 * Isnt it possible to make the post inside the .php directly?
    `pluginlyspeaking-
   floatingdiv.php`
 *  Plugin Author [PluginlySpeaking](https://wordpress.org/support/users/pluginlyspeaking/)
 * (@pluginlyspeaking)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9640479)
 * Hi,
 * I found something that could work, it requires to edit the php file.
 * Are you familiar with editing the file via your FTP client ?
    Or would you prefer
   to get a new php file and simply upload it ?
 * Let me how you would like to proceed.
 * Best Regards,
    PluginlySpeaking
 *  Thread Starter [autox420](https://wordpress.org/support/users/autox420/)
 * (@autox420)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9643782)
 * Yes i can edit files im not a total noob 😉
 * Both ways work. Just let me know what code i need to insert or just upload the
   complete new .php it doesnt matter.
 * Thanks hope it will work.
 *  Plugin Author [PluginlySpeaking](https://wordpress.org/support/users/pluginlyspeaking/)
 * (@pluginlyspeaking)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9644259)
 * Ok, so you have to add the following code at the end of the `pluginlyspeaking-
   floatingdiv.php` file (just before the ” ?> “) :
 *     ```
       add_shortcode( 'psfd_php', 'psfd_shortcode_php' );
       function psfd_shortcode_php($atts, $content = null) {
       	ob_start();
       	eval($content);
       	$output = ob_get_clean();
       	ob_end_clean();
   
       	return $output;
   
       }
       ```
   
 * It will create a shortcode that you can use like that :
 * `[psfd_php] any php code [/psfd_php]`
 * For example, the following shortcode : `[psfd_php] echo “Today is ” . date(“d/
   m/Y”); [/psfd_php]` will display : `Today is 02/11/17`
 *  Thread Starter [autox420](https://wordpress.org/support/users/autox420/)
 * (@autox420)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9644430)
 * Testing.
 *  Thread Starter [autox420](https://wordpress.org/support/users/autox420/)
 * (@autox420)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9644447)
 * Am i doing something wrong?
    Yes i added the function already to the .php
 *     ```
       [psfd_php]<?php 
       if ( 0 != get_current_user_id() ) {
         the_author_meta( 'user_description', get_current_user_id() );
         } else {
         echo 'Not logged in user';
         }
       ?>[/psfd_php]
       ```
   
 *     ```
       [psfd_php] 
       if ( 0 != get_current_user_id() ) {
         the_author_meta( 'user_description', get_current_user_id() );
         } else {
         echo 'Not logged in user';
         }
       [/psfd_php]
       ```
   
    -  This reply was modified 8 years, 6 months ago by [autox420](https://wordpress.org/support/users/autox420/).
 *  Plugin Author [PluginlySpeaking](https://wordpress.org/support/users/pluginlyspeaking/)
 * (@pluginlyspeaking)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9644508)
 * What is the output of the shortcode ?
 * Best Regards,
    PluginlySpeaking
 *  Plugin Author [PluginlySpeaking](https://wordpress.org/support/users/pluginlyspeaking/)
 * (@pluginlyspeaking)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9644563)
 * I did some tests on my side and it’s working.
 * I used the same shortcode as you :
 *     ```
       [psfd_php] 
       if ( 0 != get_current_user_id() ) {
         the_author_meta( 'user_description', get_current_user_id() );
         } else {
         echo 'Not logged in user';
         }
       [/psfd_php]
       ```
   
 * Firstly, it didn’t display anything. The reason was simple, my personnal user’s
   description was empty.
 * I put some stuff in it and then the description was displayed in the floating
   div.
 * Best Regards,
    PluginlySpeaking
 *  Thread Starter [autox420](https://wordpress.org/support/users/autox420/)
 * (@autox420)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9644586)
 * **When i use my php code in a widget.**
 * When not logged in.
 * > [View post on imgur.com](https://imgur.com/CKD4lrr)
 * 
    When logged in.
 * > [View post on imgur.com](https://imgur.com/ANKLhyb)
 * 
    ** When i use your code in floating div.
 * > [View post on imgur.com](https://imgur.com/OyGRTj2)
    -  This reply was modified 8 years, 6 months ago by [autox420](https://wordpress.org/support/users/autox420/).
 *  Thread Starter [autox420](https://wordpress.org/support/users/autox420/)
 * (@autox420)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9644613)
 * **Well the php codes works but** its another problem i have i think.
 * I dont know if you can help with this but im trying to use it like this.
    Only
   then i get that error.
 *     ```
       <iframe width="362" height="395" src="http://something.com/[psfd_php] 
       if ( 0 != get_current_user_id() ) {
         the_author_meta( 'user_description', get_current_user_id() );
         } else {
         echo 'Not logged in user';
         }
       [/psfd_php]" frameborder="0"></iframe>
       ```
   
    -  This reply was modified 8 years, 6 months ago by [autox420](https://wordpress.org/support/users/autox420/).
    -  This reply was modified 8 years, 6 months ago by [autox420](https://wordpress.org/support/users/autox420/).
    -  This reply was modified 8 years, 6 months ago by [autox420](https://wordpress.org/support/users/autox420/).
 *  Thread Starter [autox420](https://wordpress.org/support/users/autox420/)
 * (@autox420)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9645284)
 * ?
 *  Plugin Author [PluginlySpeaking](https://wordpress.org/support/users/pluginlyspeaking/)
 * (@pluginlyspeaking)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9648780)
 * Hi,
 * Sorry for the late answer, which error do you get with this code ? Is it the 
   error in the last of the three screenshots you sent me ?
 * Best Regards,
    PluginlySpeaking
 *  Thread Starter [autox420](https://wordpress.org/support/users/autox420/)
 * (@autox420)
 * [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/#post-9648862)
 * This one: [https://i.imgur.com/OyGRTj2.png](https://i.imgur.com/OyGRTj2.png)
 * I asked in stackoverflow also: [https://stackoverflow.com/questions/47096994/php-is-not-loaded-in-the-iframe](https://stackoverflow.com/questions/47096994/php-is-not-loaded-in-the-iframe)
 * I think i need to use php code all the way.
    Do you know the correct code for
   this example? I think the solution is like this. `[psfd_php] iframe echo www.
   website.comm/PHP.CODE.HERE; [/psfd_php]`

Viewing 15 replies - 1 through 15 (of 21 total)

1 [2](https://wordpress.org/support/topic/allow-php/page/2/?output_format=md) [→](https://wordpress.org/support/topic/allow-php/page/2/?output_format=md)

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

 * ![](https://s.w.org/plugins/geopattern-icon/floating-div_71757a.svg)
 * [Floating Div](https://wordpress.org/plugins/floating-div/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/floating-div/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/floating-div/)
 * [Active Topics](https://wordpress.org/support/plugin/floating-div/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/floating-div/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/floating-div/reviews/)

 * 21 replies
 * 2 participants
 * Last reply from: [autox420](https://wordpress.org/support/users/autox420/)
 * Last activity: [8 years, 6 months ago](https://wordpress.org/support/topic/allow-php/page/2/#post-9650611)
 * Status: resolved