WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Issue with include_once() (2 posts)

  1. giantmetalbowser
    Member
    Posted 4 years ago #

    I'm having a problem with the include_once() function. I am currently using the Ahimsa theme and have placed myfile.php in the ahimsa folder. Then in ahimsa's entry.php file, I added the following to attempt to use the code from myfile.php:

    if(trim(wp_title("", false)) == "myfile")
    {
      include_once("myfile.php");
      echo "got myfile.php";
    }

    The "got myfile.php" output appears on the correct page just fine, but for some reason the contents of myfile.php appear to be from an older version of the file, which displays the text "This is myfile.php" and a list of $_GET keys and values. I changed the contents of myfile.php to a simple echo statement, but the output didn't change. I don't know how it happened, since the version of the file it appears to be outputting was never in the folder. I even created a new file, named it myfile.php, pasted the contents into the new file and placed it in the ahimsa folder, but the problem still persists.

    I'm not sure if it's important, but I am currently using an offline local site on a computer running Ubuntu.

    Thanks for the help!

  2. giantmetalbowser
    Member
    Posted 4 years ago #

    Found the problem, apparently includes_once() went to the to folder I had installed WordPress in rather than staying in the ahimsa folder. I had accidentally left the old versions of the file there that I was having problems with. I replaced it with the new version, and everything's fine now :)

Topic Closed

This topic has been closed to new replies.

About this Topic