Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WillBontrager

    (@willbontrager)

    Hi DewaSurya,

    Although Insert PHP is a plugin, it won’t run proprietary WordPress functions.

    Insert PHP will work only for PHP code that would work outside of WordPress on a stand-alone page.

    As an example, this would not run on a stand-alone page by itself

    <?php comments_template(); ?>

    because comments_template() isn’t found on the page.

    Any function that’s called with code between [insert_php]…[/insert_php] tags must be defined within the tags. For example, this would work on a stand-alone page:

    <?php
    echo myfunction();
    function myfunction()
    {
       return 'Hello World!';
    }
    ?>

    Because that works on a stand-alone page, this also would work:

    [insert_php]
    echo myfunction();
    function myfunction()
    {
       return 'Hello World!';
    }
    [/insert_php]

    Will

    Thread Starter DewaSurya

    (@suryawijaya-1)

    Hi WillBontrager,

    Thank you for your reply.
    Actually I need to move the comment section into one of the tab in my post.
    I did this before with another theme “mantra / parabola”, and it works. But this time i did with constructor theme, but it seems it delete the rest of the post php code after the insertion.
    So I think it could be because of the themes compatibility too.
    Do you have any suggestion to move the comment section to be in one of the tab?

    Thank you,
    Surya

    Plugin Author WillBontrager

    (@willbontrager)

    Hi Surya,

    The reason Insert PHP isn’t working is because it can’t. The code within the [insert_php]…[/insert_php] tags can’t reach outside itself. Everything it needs to run needs to be between those tags.

    Unfortunately, I can’t help with the themes. Sorry about that.

    Will

    Plugin Author WillBontrager

    (@willbontrager)

    Gratuitous post to mark thread resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘it relace and delete the rest of the php code’ is closed to new replies.