0
votes

This is the code I have inside php tags:

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

And I get this error:

Warning: include(/wp-content/custom-php/numberedSteps.php): failed to 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' for 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 this error be fixed?

2

2 Answers

0
votes

try getting the 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');
0
votes

Try this

       include (get_theme_root().'/template-name/file-name.php'); ?>

Regards