How to include a PHP file inside WordPress php template? -


this code have inside php tags:

include('/wp-content/custom-php/numberedsteps.php');  

and error:

warning: include(/wp-content/custom-php/numberedsteps.php): failed open stream:

no such file or directory in /home/user/public_html/website.com/wp-content/themes/flatsome/woocommerce/archive-product.php on line 85

warning: include(): failed opening '/wp-content/custom-php/numberedsteps.php' inclusion (include_path='.:/usr/local/php56/pear') in /home/user/public_html/website.com/wp-content/themes/flatsome/woocommerce/archive-product.php on line 85

how can error fixed?

try getting root path first

for php >= 5.3.0 try

include(__dir__.'/wp-content/custom-php/numberedsteps.php'); 

for php < 5.3.0 try

include(dirname(__file__).'/wp-content/custom-php/numberedsteps.php'); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -