Unlink function in php
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();
}
精彩评论