Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将require_添加到wordpress模板文件中一次_Wordpress - Fatal编程技术网

如何将require_添加到wordpress模板文件中一次

如何将require_添加到wordpress模板文件中一次,wordpress,Wordpress,我正在创建wordpress模板文件。 我需要一个文件路径。我应该把代码放在哪里 <?php require_once("phpChart/conf.php");?> 使用require\u once()或include()包含文件。您没有发布您遇到了什么错误?require('phpChart/conf.php')工作正常。有什么错误?你试过functions.php吗?我试过wp_enqueue_脚本('phpChart/conf.php');在functions.php文件中

我正在创建wordpress模板文件。 我需要一个文件路径。我应该把代码放在哪里

<?php require_once("phpChart/conf.php");?>

使用
require\u once()
include()
包含文件。您没有发布您遇到了什么错误?

require('phpChart/conf.php')工作正常。

有什么错误?你试过functions.php吗?我试过wp_enqueue_脚本('phpChart/conf.php');在functions.php文件中,但类未加载
wp\u enqueue\u脚本
用于加载javascript而不是php文件。
Notice: Undefined offset: -1 in /xxx/wp-includes/post-template.php on line 262 Call Stack #TimeMemoryFunctionLocation 10.0003283432{main}( ).../index.php:0 20.0004287208require( '/xxx/wp-blog-header.php' ).../index.php:17 30.454546621040require_once( '/xxx/wp-includes/template-loader.php' ).../wp-blog-header.php:16 40.459646824600include( '/xxx/wp-content/themes/gazette-child/email.php' ).../template-loader.php:74 50.537247474312get_header( ).../email.php:18 60.537547477952locate_template( ).../general-template.php:45 70.537547478144load_template( ).../template.php:477 80.537747516408require_once( '/xxx/wp-content/themes/gazette-child/header.php' ).../template.php:501 90.581648215152the_excerpt( ).../header.php:56 100.581648215264get_the_excerpt( ).../post-template.php:336 110.581748215672apply_filters( ).../post-template.php:367 120.581748217056call_user_func_array:{/xxx/wp-includes/plugin.php:213} ( ).../plugin.php:213 130.581748217088wp_trim_excerpt( ).../plugin.php:213 140.581748217248get_the_content( ).../formatting.php:2609 " /> ( ! ) Notice: Undefined offset: -1 in /xxx/wp-includes/post-template.php on line 262 Call Stack #TimeMemoryFunctionLocation 10.0003283432{main}( ).../index.php:0 20.0004287208require( '/xxx/wp-blog-header.php' ).../index.php:17 30.454546621040require_once( '/xxx/wp-includes/template-loader.php' ).../wp-blog-header.php:16 40.459646824600include( '/xxx/wp-content/themes/gazette-child/email.php' ).../template-loader.php:74 50.537247474312get_header( ).../email.php:18 60.537547477952locate_template( ).../general-template.php:45 70.537547478144load_template( ).../template.php:477 80.537747516408require_once( '/xxx/wp-content/themes/gazette-child/header.php' ).../template.php:501 90.585448229760the_excerpt( ).../header.php:68 100.585448229840get_the_excerpt( ).../post-template.php:336 110.585448230048apply_filters( ).../post-template.php:367 120.585448231280call_user_func_array:{/xxx/wp-includes/plugin.php:213} ( ).../plugin.php:213 130.585448231312wp_trim_excerpt( ).../plugin.php:213 140.585448231392get_the_content( ).../formatting.php:2609 - http://xxx/email/">