在WordPress的自定义PHP模板调用函数(Calling a function in a cu

2019-09-18 11:54发布

我想调用的函数,而在另一个PHP类,我在WordPress的写道。 不过,我感到困惑的语法,比如让一个页面,你只需调用get_header()的头; 等等。但我怎么调用特定类的功能? 例如在index.php中我要调用一个名为this_function()函数,它驻留在说test.php的。 ,这是什么语法?

我怀疑它是非常简单的,但我不能得到正确的语法,我不能帮助任何网上。

谢谢

Answer 1:

首先使用require_once()以包含test.php的,即

require_once("path\test.php");

然后,你可以简单地调用this-function()它会工作。

您可以使用此作为参考: http://www.php.net/manual/en/function.require.php



文章来源: Calling a function in a custom php template in Wordpress