我有一个函数列表,它们运行一个相当深的例程来确定从哪个post_id获取其内容并将其输出到站点的前端.
当这个函数返回它的内容时,我希望它包装在一个html包装器中.我希望这个html包装器只在函数有返回的输出时才加载.
在示例中,我有以下...
public static function output_*() {
// my routines that check for content to output precede here
// if there IS content to output the output will end in echo $output;
// if there is NO content to output the output will end in return;
}
Run Code Online (Sandbox Code Playgroud)
完整的解释,我有以下......
如果其中一个函数返回一个输出,我希望它包装在一个html包装器中,所以理论上这样的东西就是我想要完成的...
public static function begin_header_wrapper() {
// This only returns true if an output function below returns content,
// which for me is other than an empty return;
include(self::$begin_header_wrapper); …Run Code Online (Sandbox Code Playgroud) 我正在与...
global $pagenow;
if(in_array($pagenow, array('example1.php','example2.php'))) {}
Run Code Online (Sandbox Code Playgroud)
在Wordpress中,此方法适用于仅在所需的管理页面上排队管理脚本。
有没有办法将相同的概念应用于查询页面?
例:
global $pagenow;
if(in_array($pagenow, array('example1.php?page=example1','example2.php?page=example1'))) {}
Run Code Online (Sandbox Code Playgroud)
有一些插件我正在尝试使设置更有效地进行加载,但是有些插件对其页面使用页面查询,因此上述代码不起作用。
我没有在网上找到任何东西。