Ready to get started?Download WordPress


Call up PHP file (9 posts)

  1. mukki
    Posted 6 years ago #

    Does anyone know how to call up a php file in wordpress? I have a php file and i want to insert it in a page of mine. Is there a way to do that?
    I looked up everywhere but i just found a php exec script but I just want to call it up and use its funtions.

  2. mrmist
    Forum Janitor
    Posted 6 years ago #

    You can either add your PHP / include to a template, or you can use a plugin that lets you execute PHP from within "normal" posts.

  3. mukki
    Posted 6 years ago #

    i don't want to execute it.
    I want to somehow call it. I tried the php-exec script == didn't work.
    Then I tried the runPHP == also didn't work.

    I tried to insert the php code into index.php and it worked, but then the function has been available at every page.

  4. Roy
    Posted 6 years ago #

    It seems that you're well passed halfway. How about putting it in the index.php, save it under another name and on the place where you DO want the code executed, use that template? Do you want to call it with a certain page or post? When writing that one you can choose that other template.

  5. mukki
    Posted 6 years ago #

    I have a script like that and I want it to be executed in my wordpress from a specific Page.


  6. mukki
    Posted 6 years ago #

    anyone know?

  7. Roy
    Posted 6 years ago #

    Hm, this was easier in older versions. In the sidebar of the admin in the "write" screen, you could simply choose a template. Maybe in newer versions this option is only there when you have different templates. In any case, try the options from my previous reply:
    - make a new template with the code in it. you can just open the index.php, put the code in and save it as "index2.php" or whatever name you have in mind;
    - "manage" that page that you want to use the template from and see if you can choose that other template (index2 or whatever you called it).

    If that doesn't work, I'm out of suggestions.

  8. Dgold
    Posted 6 years ago #

    This explains how to create custom page templates, and how to switch your page to your custom template, example my-very-special-unique-page.php

    This explains how to "include" your own custom php template file,

    Also take a look at this plugin,

    I hope this helps ya.

  9. mukki
    Posted 6 years ago #

    thank you very much.i will start doing it right now

Topic Closed

This topic has been closed to new replies.

About this Topic