您的位置:首页 > 其它

wordpress 自己创建插件怎么创建

2015-06-02 21:57 531 查看
我是个wordpress菜鸟,刚学习什么都不会,插件都不会自己写,老手就不要笑话了,对新手应该有点用吧

首先你要在htdocs\wp-content\plugins 写一个文件夹谢你插件的名字,然后再文件夹里写一个与文件夹同名的php文件,然后就是在这个文件里写这个插件的基本信息了,首先是这个php文件的头部:

<?php
/*
Plugin Name: countlick
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates Description: countckick
Version: qiuyan: 1.0
Author:qiuyan
Author URI: http://URI_Of_The_Plugin_Author:qiuyan */
?>

设置了这个插件的基本简单介绍:

要把这个插件放到setting中显示出来就要加载
<?php
add_action('admin_menu', 'share_like_count_create_menu');//加载setting里的名字
add_action('admin_notices', 'count_pro_notification');//setting页面的头部注意事项
function count_pro_notification(){
if (get_option('amts_hide_pro_notice') != 'yes'){
echo '<div class="updated">'.'<p><b>Share-like-button-count</b> now works with <b>W3 Total Cache</b>, have support for <b>QR code</b> and can serve different <b>Home Page</b> based on mobile devices.<br/>Click <a href="http://dnesscarkey.com/any-mobile-theme-switcher-pro/" target="_blank">here</a> for details.     </p>
</div>';
}
}
function share_like_count_create_menu() {
add_options_page('Share-like-button-count', 'Share-like-button-count', 'administrator', __FILE__, 'includePage');
//add_action('admin_init', 'register_mysettings_theme');
}
//这里加载的在setting页面的加载显示的页面的
function  includePage(){
global $amts_force_param;
include('settingpage.php');

}

?>


再写个加载显示的页面就可以了,至于功能就是通过wordpress的一些hook或其他的函数来实现了。菜鸟一枚,希望大家多多指教


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: