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']))附原码:
<?php/*Plugin Name: Copyright NoticesPlugin 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 BrazellVersion: 1.0Author 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 '<div id="message" class="updated fade"><p>' . __('Options Saved','copyright-notices') . '.</p></div>';} ?><div class="wrap"><h2><?php _e('Copyright Notices Configuration','copyright-notices') ?></h2><p><?php _e('On this page, you will configure all the aspects of this plugins.','copyright-notices') ?></p><form action="" method="post" id="copyright-notices-conf-form"><h3><label for="copyright_text"><?php _e('Copyright Text to be inserted in the footer of your theme','copyright-notices') ?>:</label></h3><p><input type="text" name="copyright_text" id="copyright_text" value="<?php echo get_option('copyright_notices_text','copyright-notices') ?> " /></p><p class="submit"><input type="submit" name="submit" value="<?php _e('Update options »','copyright-notices'); ?>" /></p><?php wp_nonce_field('copyright_notices_admin_options-update'); ?></form></div><?php} function display_copyright(){if( $copyright_text = get_option('copyright_notices_text' ) ){echo '<p class="copyright_text">' . $copyright_text . '</p>';}} add_action('wp_footer','display_copyright'); function display_copyright_feed( $post_content ){if( !$copyright_text = get_option('copyright_notices_text') || !is_feed() ){return $post_content;} return $post_content . $copyright_text;}add_filter('the_content','display_copyright_feed');
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']))附原码:
<?php/*Plugin Name: Copyright NoticesPlugin 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 BrazellVersion: 1.0Author 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 '<div id="message" class="updated fade"><p>' . __('Options Saved','copyright-notices') . '.</p></div>';} ?><div class="wrap"><h2><?php _e('Copyright Notices Configuration','copyright-notices') ?></h2><p><?php _e('On this page, you will configure all the aspects of this plugins.','copyright-notices') ?></p><form action="" method="post" id="copyright-notices-conf-form"><h3><label for="copyright_text"><?php _e('Copyright Text to be inserted in the footer of your theme','copyright-notices') ?>:</label></h3><p><input type="text" name="copyright_text" id="copyright_text" value="<?php echo get_option('copyright_notices_text','copyright-notices') ?> " /></p><p class="submit"><input type="submit" name="submit" value="<?php _e('Update options »','copyright-notices'); ?>" /></p><?php wp_nonce_field('copyright_notices_admin_options-update'); ?></form></div><?php} function display_copyright(){if( $copyright_text = get_option('copyright_notices_text' ) ){echo '<p class="copyright_text">' . $copyright_text . '</p>';}} add_action('wp_footer','display_copyright'); function display_copyright_feed( $post_content ){if( !$copyright_text = get_option('copyright_notices_text') || !is_feed() ){return $post_content;} return $post_content . $copyright_text;}add_filter('the_content','display_copyright_feed');
解决方案 »
- 关于redirect的问题
- DEDE支持XML文件入库吗?请问怎么实现XML内容入库
- centos apache死活启动不了,不报错,卸载重新安装仍然无法解决
- 怎么把一个二维数组转成另一个二维数组
- phpExcelReader导入mysql问题
- asp 提交数据 与asp.net 提交数据
- sha1()加密登录问题
- supertpl 只能循环遍历数组,没有for等对单个变量的循环?
- 网站改版,用PHPcms(急)
- [急求]ubuntu下使用php调用ffmpeg转换视频格式、抽帧、摄像头实时录入不成功,是php设置问题?还是代码的问题?
- 我想知道PHP模块从那开始学习
- 我想在自己电脑上搭服务器,远程能够访问,怎么配置apache?
而php的函数中间是不能有“-”的
于是抛错
你给的错误提示写得很明白啊……
谢谢大家了