2

是否可以擦除用户定义的函数?

我的 CMS 有一个功能,我想通过添加来更新它。

尝试在主题代码中添加一些代码,这将使我的代码仅在打开此主题时才起作用。

4

2 回答 2

2

尝试rename_function()将要覆盖的函数重命名为其他名称,然后以原始名称编写函数。

于 2011-01-29T16:59:56.967 回答
0

在选择所需主题之前,不要包含或启动该代码。

我的functions.php中的默认主题代码:

<?php
function sample()
{
    // the specific code here
}

在主题引导的某个地方:

<?php
include 'functions.php';
sample();

// OR inside a theme.

if ($theme_name == 'default')
{
    // Call the function
    sample();
}
于 2011-01-29T18:49:25.337 回答