wordpress圣经 的源码 有有关问题吗
程序员文章站
2024-01-11 20:28:16
...
wordpress圣经 的源码 有问题吗?
wordpress 圣经 在讲Chapter 5: Extending WordPress with Plugins时,有个例子,我在试用时出现这样的问题,请高手指点:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'copyright-notices' not found or invalid function name in E:\xampp\htdocs\chinese\wp-includes\plugin.php on line 405:
call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']))
附原码:
/*
Plugin Name: Copyright Notices
Plugin URI: http://emmense.com/copyright-notices/
Description: A plugin that allows the user to set Copyright text in the theme and control it from WordPress Admin.
Author: Aaron Brazell
Version: 1.0
Author URI: http://technosailor.com/
*/
function i18n_copyright()
{
$plugin_path = plugin_basename( dirname( __FILE__ ) .'/translations' );
load_plugin_textdomain('copyright-notices', $plugin_path );
}
add_action('init','i18n_copyright');
function copyright_notices_admin_page() {
add_submenu_page( 'plugins.php',__('Copyright Notices Configuration'), __('Copyright Notices Configuration','copyright-notices'), 0, 'manage_options', 'copyright-notices', 'copyright_notices_admin');
}
add_action('admin_menu', 'copyright_notices_admin_page');
function copyright_notices_admin()
{
if( $_POST['submit'] )
{
if( check_admin_referer('copyright_notices_admin_options-update') )
{
$options_saved = false;
if( $oldvalue = get_option('copyright_notices_text') )
{
update_option( 'copyright_notices_text', $_POST['copyright_text'] );
if( $oldvalue == get_option('copyright_notices_text') )
{
$options_saved = true;
}
}
else
{
if( add_option( 'copyright_notices_text', $_POST['copyright_text'] ) )
{
$options_saved = true;
}
}
}
}
if( $options_saved )
{
echo '';
}
?>
wordpress 圣经 在讲Chapter 5: Extending WordPress with Plugins时,有个例子,我在试用时出现这样的问题,请高手指点:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'copyright-notices' not found or invalid function name in E:\xampp\htdocs\chinese\wp-includes\plugin.php on line 405:
call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']))
附原码:
/*
Plugin Name: Copyright Notices
Plugin URI: http://emmense.com/copyright-notices/
Description: A plugin that allows the user to set Copyright text in the theme and control it from WordPress Admin.
Author: Aaron Brazell
Version: 1.0
Author URI: http://technosailor.com/
*/
function i18n_copyright()
{
$plugin_path = plugin_basename( dirname( __FILE__ ) .'/translations' );
load_plugin_textdomain('copyright-notices', $plugin_path );
}
add_action('init','i18n_copyright');
function copyright_notices_admin_page() {
add_submenu_page( 'plugins.php',__('Copyright Notices Configuration'), __('Copyright Notices Configuration','copyright-notices'), 0, 'manage_options', 'copyright-notices', 'copyright_notices_admin');
}
add_action('admin_menu', 'copyright_notices_admin_page');
function copyright_notices_admin()
{
if( $_POST['submit'] )
{
if( check_admin_referer('copyright_notices_admin_options-update') )
{
$options_saved = false;
if( $oldvalue = get_option('copyright_notices_text') )
{
update_option( 'copyright_notices_text', $_POST['copyright_text'] );
if( $oldvalue == get_option('copyright_notices_text') )
{
$options_saved = true;
}
}
else
{
if( add_option( 'copyright_notices_text', $_POST['copyright_text'] ) )
{
$options_saved = true;
}
}
}
}
if( $options_saved )
{
echo '
' . __('Options Saved','copyright-notices') . '.
}
?>
专题推荐
-
独孤九贱-php全栈开发教程
全栈 170W+
主讲:Peter-Zhu 轻松幽默、简短易学,非常适合PHP学习入门
-
玉女心经-web前端开发教程
入门 80W+
主讲:灭绝师太 由浅入深、明快简洁,非常适合前端学习入门
-
天龙八部-实战开发教程
实战 120W+
主讲:西门大官人 思路清晰、严谨规范,适合有一定web编程基础学习
上一篇: 新品牌推广五大策略详解
下一篇: phpMyAdmin 2.x.x
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论