Support » Plugins » include php on a page

  • OK. I’m stumped on this one. Hopefully somebody can shed some light on this.

    I am attempting to get a php site running in a page on my wordpress site.

    I got the site running correctly in a separate folder. Check it out here.

    I got as far as creating a stripped down page template and assigning it to that page. The site comes up but the path is incorrect. It keeps trying to use the blog path instead of the relative path. ie /freecookingvideos instead of /freecookingvideos/recipepage.

    I have tried putting the entire path in the config file of the php site and in wordpress. Nothing works. 🙁

    Maybe I just can’t do this without some plugin but it seems like a simple command somewhere is eluding me.

    here is the code in the page template I am using.
    Template Name: Recipe

    <?php get_header(); ?>

    <?php $siteurl= ‘’; ?>
    <?php require (‘’); ?>

    <?php get_footer();

    The $siteurl line is probably useless, but it was worth a shot.

    I have even removed the header and footer and still the path stays the same.

    Well back to beating my head against the wall. 😕

    here is the link to the blog page.

Viewing 15 replies - 1 through 15 (of 17 total)
  • In the “require” line you have a URI, not a path!

    Thanks moshu:

    I went and changed it to
    <?php require (‘’); ?>

    But it still goes to the abspath.

    Is there a way to change the path for a page ?

    It’s still an Url use something like

    test/test.php (if the file is in the subdir test)

    /var/…/htdocs/wordpress/test.php (if you know the complete path on your webserver)

    Also be aware if “recipepage” is a folder – I am afraid it will not work. You use the include to include a file.
    Another issue: If the included file is a complete html page (having its own head, body etc.) then you are looking forward to a lot of validation errors and headache…

    Thanks for the reply moshu & Stefan

    recipepage is a folder. I thought it wise not to mix these files in with the wp files.

    I suppose I could rename some files and put it right in the root. There are many common names that are re-used such as index.php.

    I tried the ezstatic plugin and that made the path /freecookingvideo/recipe

    Without really understanding how the pages work, I would not want to play with that.

    Is it possible to write a plugin to do this or do you know of one available ?

    It is a shame, because I am so close I can taste it.

    I suppose it is possible to include the recipe database in the wordpress database and put the code right into a page. I read about that somewhere. I think that is more work than it is worth at this point though. But if you can point me towards some documentation for doing such a thing, I would greatly appreciate it.

    Thanks again

    I have no idea what that script of your does or how does it works. Sorry.
    I know how to make a simple php script to work in a WP template or Page or post; I know how to include a .php file into another.
    However, what you seemingly want: to combine two independent scripts that have their own database and so on.
    Well, for that a simple “include” will not siffice, it will not a bit more work.
    You should post more about the other script you are using (e.g. its source, URL etc.) and about how do you want to make it work together with WP etc.
    Then maybe somebody can help you.

    Perhaps I didn’t get it right the first time.

    If you have two different applications in two different paths, the easiest way is this:

    Create themes for both

    Use a static doorwaypage to switch from first to second application. Otherwise you have to process all links to the new application.

    Thanks for the replies all.

    The script is from

    It is the recipe site that I am using.

    It is a free download and free to use as long as you leave the link in at the bottom.

    I am fairly competent at using php but by no means an expert. So I can follow basic instructions and troubleshoot most problems by looking at the code.

    I thought getting a ready made script that already works would be easier than creating one from scratch.

    The script is working fine the location it is stored.

    Stefan: Can you elaborate on the doorway page ? Or point me towards documentation ? I hate to waste peoples time if there is something I can read to answer my questions.

    I know I can always just create a separate page outside of wordpress to accomplish what I need, but prefer to have it all in wordpress if possible, nice and clean.

    Thanks again for your time

    I’ve read the description of that script: except the mailing list/newsletter and “search voyeur” – everything else exist in WP and/or plugins.
    Yes, I konw, it’s more work… I just wanted to let you know.


    I was probably going to get rid of those 2 features anyway.

    But just to clarify, are you saying I could import the recipe database into the wp database and put the php code into a page, or someting similar ?

    I am more interested in what works best not necessarily what is the easiest.



    are you saying I could import the recipe database into the wp database and put the php code into a page

    No, I’ve never said anything like that 😉
    What I said is: from the beginning you did NOT need any additional script, since (almost) everything what that script does could be achieved by WP.
    However, if you already have lots of recipes in that script’s database… I am clueless.

    Actually I don’t have any recipes in the database. It comes with a bunch though. I would be willing to enter in my own recipes into a new database, but I am not sure what where to begin to set that up in wordpress. I would need a user interface to enter the recipes and a way to display them by category.
    You say all the capabilites exist in WordPress that were in the recipe script, can you point me towards some documentation or maybe sites that are set up like that ?



    I am a bit confused. I assumed you have a WP site/blog… where every recipe can be a post + every post must be in a category – so I don’t see the issue.
    No separate database, no special interface, no complications. I remember several instances in the forum when users were presenting their cooking/recipe blogs.
    Doing a search for recipes or similar keywords, probably, will get you to some examples.

    And this is from the script’s site:
    * List recipes by category
    * Rate a recipe functionality
    * Email recipe to a friend functionality
    * Email newsletter signup functionality
    * View top 10 rated recipes
    * Full text search of the entire recipes database
    * Users can create accounts to add their own recipes to your site. Your users provide your content
    * Users can view the recipes they have added and see which are waiting for approval, added or been declined

    As I said, except the newsletter/mailing list everything can be done with basic WP features or plugins. I also added: + work 🙂

    I’m havng a similar problem, I think: I want to include a separate PHP file on a capital-P Page. This code does nothing:

    <B>Here are our current contributors…</B>

    <?PHP include ‘’ ?>

    Is this simply a matter of using an absolute path, or is callng PHOP from a Page forbidden?


    Bloodhound: Try putting the url in parens like this
    <?PHP include ‘’)?>

    Moshu: I never thought of using posts as the method of storing the recipes. I was hoping to have a database that could be maintained outside of wordpress and accessed from within wordpress.
    Your suggestion is a good one and I will consider using it , at least for the short term.

    Being a relatively new to wordpress, I tend to think more in terms of things I know better like mysql and php.

    My main page/blog is videos of recipes. I wanted to make written recipes separate. Which would still work with your suggestion. I would probably need to make a new set of categories and sidebars for the recipe page though, to keep it clean.

    Thanks for your patience and all your help.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘include php on a page’ is closed to new replies.