<?php
/*
Plugin Name: yw-copyright
Plugin URI: http://favoriteposts.com
Description: Simple and flexible favorite buttons for any post type.
Version: 2.2.0
Author: Kyle Phillips
Domain Path: /languages/
License: GPLv2 or later.
*/
date_default_timezone_set("Asia/Shanghai");
//初始化进行的操作
register_activation_hook(__FILE__,"yw_copyright_install");
function yw_copyright_install(){
update_option("yw_copyright_text","<p>请注明转载出</p>");
}
//停止时候的操作
//未 wp_footer 挂载一个新动作
register_deactivation_hook(__FILE__,"yw__copyright_deactivation");
function yw_copyright_deactivation(){
update_option("yw_copyright","stop");
}
add_action("wp_head","yw_copyright_insert");
function yw_copyright_insert(){
echo get_option("yw_copyright_text");
}
//测试,
//add_action("post_author_meta_box","yw_test");
//function yw_test(){
// echo "初始化文章窗口";
//}
//保存文章的钩子,设置参数
add_action("save_post","save_post_meta",10,2);
function save_post_meta($post_id,$post){
update_post_meta($post_id,"save-time","更新时间".date("Y-m-d h:i:s"));
}
?>