wordpress 自己创建插件怎么创建

我是个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或其他的函数来实现了。菜鸟一枚,希望大家多多指教


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值