include_path=www/includes. The include() function takes all the text in a specified file and copies it into the file that uses the include function. return $string; //returns the second argument passed into the f Instead of copying/pasting this code on to every page, you could simply place your header code into one include file and your footer code into another include file. Including a file produces the same result as copying the script from the file specified and pasted into the location where it is called. Description. Including a file inside a subdirectory is the same as any other as long as you know the path to the file. www/includes. The second.js file imports this function from the first.js file first; only then can it call it. functions Example: This example contains four PHP files (file1.php, file2.php, file3.php, file4.php) in a directory. Since it's possible to move the 'wp-content' directory, don't pass that part of the path to the require statement; instead, use the WP_CONTENT_DIR constant. ; Use require_once construct to load the code from another file once and won’t include the file again if the file has been loaded. How include methods work in PHP with examples? - EDUCBA ini_set function sets the include_path configuration option and can be used in individual php file to create php settings on the fly. It makes a copy of the source file to the destination file and if the destination file already exists, it gets overwritten. It doesn't deal with relative file paths though; you still have to do that … include('common-functions.php'); echo 'Name of first employee is ' . context. 'subdir/file') the specified file gets included (or required, which leads to fatal errors) but if any WordPress functions are called within 'file' I get something similar to: Include files in functions.php - WordPress Development Stack …