开发者

Unlink function in php

开发者 https://www.devze.com 2023-02-07 04:48 出处:网络
Is it possible to erase user-defined function? My CMS has one function, which I want to update with additions.

Is it possible to erase user-defined function?

My CMS has one function, which I want to update with additions.

Trying to add some cod开发者_StackOverflow社区e to theme's code, that would make my code work only when this theme is switched on.


Try rename_function() to rename the function you want to override to something else and then write the function under the original name.


Do not include or launch that code until the required theme is chosen.

My code for Default Theme from functions.php:

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

Somewhere in the theme bootstrapping:

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

// OR inside a theme.

if ($theme_name == 'default')
{
    // Call the function
    sample();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消