using php includes on pages (18 posts)

  1. bornfamous
    Posted 10 years ago #

    I created a page with a php include in it for rss feeds/headlines, but it doesn't work:


    What do I need to do to get this working?

    TIA :o]

  2. prissed
    Posted 10 years ago #

    Get this plugin:

    Then wrap your php code in:

    <?php include("file.php"); ?>

  3. bornfamous
    Posted 10 years ago #

    It worked! Thank you!!!

  4. chentong
    Posted 9 years ago #

    This doesn't seem to work for me.
    I am using php v4.3.10 with wordpress 1.5.2

    After wrapping the php code with <phpcode> and </phpcode>, what I get in the result page is the php code without the wrappers.

    anyone can help? Thanks.

  5. moshu
    Posted 9 years ago #

    did you install and activate the plugin linked above before putting the code in your page?

  6. Darcie
    Posted 9 years ago #

    I could not get Include to work correctly for awhile either. The answer for me was to upload the php file to my acutal root directory not the blog directory and use this line of type.

    // must include this script
    include('http://swatchnot.hender-son-s.com/arrow.php'); ?>
    Want the code?

    I will have to try the above as well.

  7. chentong
    Posted 9 years ago #

    hi moshu,

    Yes, I did.
    I uploaded the file "phpexec.php" to the wordpress directory of "wp-content/plugins/".

    Subsequently I activated it from wordpress admin panel's "plugins".

    Then I add the code in the post.
    I think I have done it correctly. Not sure whether there is still any setting in the wordpress that require changes. or is phpexec support wordpress v1.5.2?

    Darcie, which php file you upload to root directory? the phpexec.php? in such case, how are you going to activate the plugins? and your code is without 'php' after '<?'. I am very new to php, so this is just to confirm that I understand it correctly.


  8. Darcie
    Posted 9 years ago #

    No it was actually just a php file for my progress meter. It is not plug-in ready yet. I wish someone would write me a plugin for it. If it were already a plugin I think it would not have been a prob.

    I guess what I am saying is I am doing manually and maybe I should re-insert my question into another forum.

  9. davidchait
    Posted 9 years ago #

    Darcie - don't do includes that use URLs, they should only use absolute or relative paths within your site. Trying to include a URL usually won't work...


  10. chentong
    Posted 9 years ago #

    Hi David,

    I took a look at your CG-Amazon. Not sure whether I understand correctly that it doesn't support realtime price feeding from Amazon.

    I have been trying to find a way to insert price feeding into a blog post.

    WP-Amazon and AMM don't support price feeding. MrRat' script seems to support price feed, but I need to < ?php include ...> the result url in a page. (in which phpexec doesn't seem to work for my case...)

    I am looking at amazon-o-matic too.

    Not sure whether you have anyway of inserting realtime price feed of an Amazon product into a post?


  11. chentong
    Posted 9 years ago #

    Hi David, is cg-quickphp supports command like "include"?

    For instance, <quickphp include("http://www.domain.com/onesection.php"); />


  12. gmdavis62
    Posted 9 years ago #

    I found that using phpexec with wordpress 2.0 and php 4.4.1 will add <br /> tags to the end of each line of the include making it useless.

    I am using the non-rich post editor and I cannot find any way to turn this "feature" off. I suspect WordPress is adding the <br /> tags. I don't see anything adding this in the phpexec code.

  13. gmdavis62
    Posted 9 years ago #

    UPDATE: I just found that (for both runPHP and PHPexec) if you enclose your php in <pre> </pre> tags, WordPress won't insert <br /> at the end of each line of the resulting html.

    However, some php includes still don't work as expected. I'm not sure yet what is happening.

  14. PaulSmith
    Posted 9 years ago #

    I tried all the suggestions here and none work running PHPexec in WP 2.0.2.

  15. jwurster
    Posted 9 years ago #

    If you check the plugins that don't work with wp2.0, phpexec is one of them. I also use this plugin and am looking for a solution.

  16. Kafkaesqui

    Posted 9 years ago #

  17. JackPo
    Posted 9 years ago #

    I found out how to fix the <br > issue from this link:


    It turns out that all the php module will do the same thing because wordpress' core engine is adding the line breaks, and not the plugins.

    Basically, edit the file functions-formatting.php in folder wp-includes


    function wpautop($pee, $br=1) {


    function wpautop($pee, $br=0) {

    and it should fix the problem.

  18. OrchidRed
    Posted 8 years ago #

    I'm having a problem with the phpexec plugin as well. I'm running WP 2.0.4. I activated the plugin but when I put php code in a "page" nothing happens. If I wrap the code in "phpcode" or "pre" tags what displays is this instead of the actual inc file:

    <?php include("books3.inc"); ?>

    Am I doing something wrong? You can see what I'm talking about here. What should be displaying is a list of book ratings like the ones in the sidebar.


Topic Closed

This topic has been closed to new replies.

About this Topic