wordpress bible 插件 第一个例子是 讲在帖子后增加版权内容的。我把相关代码弄到一起,可总是也调试不好。请问:哪位有完整的?我下面的总出错啊!
<?php
/*
Plugin Name: ABC 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 copyright_notices_admin()
{
?>
<div class=”wrap”>
<h2>Copyright Notices Configuration</h2>
<p>On this page, you will configure all the aspects of this
plugins.</p>
<form action=”” method=”post” id=”copyright-notices-conf-form”>
<h3><label for=”copyright_text”>Copyright Text to be inserted
in the footer of your theme:</label></h3>
<p><input type=”text” name=”copyright_text” id=”copyright_
text” value=” <?php echo esc_attr( get_option(‘copyright_notices_text’) )
?> “ /></p>
<p class=”submit”><input type=”submit” name=”submit”
value=”Update options »” /></p>
<?php wp_nonce_field(‘copyright_notices_admin_optionsupdate’);
?>
</form>
</div>
<?php
}function copyright_notices_admin_page() {add_submenu_page( 'plugins.php','Copyright Notices Configuration', 'Copyright Notices Configuration', 'manage_options', 'copyright-notices' 'copyright_notices_admin');}
//Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in E:\xampp\htdocs\chinese\wp-content\plugins\copyright.php on line 35add_action('admin_menu', 'copyright_notices_admin_page');function save_copyright_notices(){if( check_admin_referer('copyright_notices_admin_options-update') ){if( update_option( 'copyright_notices_test', stripslashes( $_POST['copyright_text'] ) ) ) wp_redirect( __FILE__ . '?updated=1' );}}add_action( 'load-plugins_page_copyright-notices', 'save_copyright_notices' );
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’);
?>
<?php
/*
Plugin Name: ABC 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 copyright_notices_admin()
{
?>
<div class=”wrap”>
<h2>Copyright Notices Configuration</h2>
<p>On this page, you will configure all the aspects of this
plugins.</p>
<form action=”” method=”post” id=”copyright-notices-conf-form”>
<h3><label for=”copyright_text”>Copyright Text to be inserted
in the footer of your theme:</label></h3>
<p><input type=”text” name=”copyright_text” id=”copyright_
text” value=” <?php echo esc_attr( get_option(‘copyright_notices_text’) )
?> “ /></p>
<p class=”submit”><input type=”submit” name=”submit”
value=”Update options »” /></p>
<?php wp_nonce_field(‘copyright_notices_admin_optionsupdate’);
?>
</form>
</div>
<?php
}function copyright_notices_admin_page() {add_submenu_page( 'plugins.php','Copyright Notices Configuration', 'Copyright Notices Configuration', 'manage_options', 'copyright-notices' 'copyright_notices_admin');}
//Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in E:\xampp\htdocs\chinese\wp-content\plugins\copyright.php on line 35add_action('admin_menu', 'copyright_notices_admin_page');function save_copyright_notices(){if( check_admin_referer('copyright_notices_admin_options-update') ){if( update_option( 'copyright_notices_test', stripslashes( $_POST['copyright_text'] ) ) ) wp_redirect( __FILE__ . '?updated=1' );}}add_action( 'load-plugins_page_copyright-notices', 'save_copyright_notices' );
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’);
?>
解决方案 »
- 数据同步
- PHP导出EXCEL后制表符不管用
- 怎样用正则替换掉url某个参数?
- linux的php配置问题
- 每次进行mysql_connect(pconnect)操作后是否都要释放内存?
- 安装了Apache后,在“服务”中没有选象
- 求解"&"的用法,绝顶高手入来吧。
- 能不能在insert完数据后返回auto_increment字段的值?如果insert语句没有这个功能还有比较高效的办法吗?
- PHP_病_毒_来_了_(能感染的木马程序)
- 请问哪里有将linux下的pop3邮件解析出来,做成象163.net邮件系统效果的代码?给个建议怎么解决?
- PHP如何获取正在上传的文件的进度
- 这个网站可以设置robots文件吗
with Plugins 第一个例子 Copyright Notices 的完整代码,有现成的吗?谢谢。