WordPress.org

Ready to get started?Download WordPress

Forums

Insert PHP
[resolved] it relace and delete the rest of the php code (5 posts)

  1. DewaSurya
    Member
    Posted 6 months ago #

    Hi I have installed it, and use the plugin, it worked but unfortunately it also deleting the rest of the post code after the insertion.
    What I add is [insert_php] comments_template(); [/insert_php]
    Please refer to my link here : http://www.baliboutiquevillas.com/villa-kubu-d-kubu/
    It shows that the footer and sidebar is gone..

    Any help would be appreciated.

    http://wordpress.org/plugins/insert-php/

  2. WillBontrager
    Member
    Plugin Author

    Posted 6 months ago #

    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

  3. DewaSurya
    Member
    Posted 6 months ago #

    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

  4. WillBontrager
    Member
    Plugin Author

    Posted 6 months ago #

    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

  5. WillBontrager
    Member
    Plugin Author

    Posted 5 months ago #

    Gratuitous post to mark thread resolved.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.