2015-04-29 85 views
0

这是我里面php标签代码:如何在WordPress的php模板中包含PHP文件?

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

而且我得到这个错误:

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

如何这个错误是固定的?

+0

你的路径错误 – Enjoyted

回答

0

尝试获得根路径优先

为PHP> = 5.3.0尝试

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

对于PHP 5.3.0 <尝试

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

试试这个

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

问候

相关问题