Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Author PluginlySpeaking

    (@pluginlyspeaking)

    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

    (@autox420)

    Sh*t little bit disapointed. Hope you will make it possible.

    • This reply was modified 7 years, 4 months ago by autox420.
    Thread Starter autox420

    (@autox420)

    Isnt it possible to make the post inside the .php directly?
    pluginlyspeaking-floatingdiv.php

    Plugin Author PluginlySpeaking

    (@pluginlyspeaking)

    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

    (@autox420)

    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

    (@pluginlyspeaking)

    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

    (@autox420)

    Testing.

    Thread Starter autox420

    (@autox420)

    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 7 years, 4 months ago by autox420.
    Plugin Author PluginlySpeaking

    (@pluginlyspeaking)

    What is the output of the shortcode ?

    Best Regards,
    PluginlySpeaking

    Plugin Author PluginlySpeaking

    (@pluginlyspeaking)

    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

    (@autox420)

    When i use my php code in a widget.

    When not logged in.

    View post on imgur.com


    When logged in.

    View post on imgur.com



    When i use your code in floating div.

    View post on imgur.com

    • This reply was modified 7 years, 4 months ago by autox420.
    Thread Starter autox420

    (@autox420)

    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="https://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 7 years, 4 months ago by autox420.
    • This reply was modified 7 years, 4 months ago by autox420.
    • This reply was modified 7 years, 4 months ago by autox420.
    Thread Starter autox420

    (@autox420)

    ?

    Plugin Author PluginlySpeaking

    (@pluginlyspeaking)

    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

    (@autox420)

    This one: https://i.imgur.com/OyGRTj2.png

    I asked in stackoverflow also: 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)
  • The topic ‘Allow PHP’ is closed to new replies.