WordPress : Adding Administration Menus

If you want to give your pluging an options page,you must set a administration menu or options sub menu. Some manual can find it on wordpress.org.
OK,to add an administration menu, you must do three things:

1. Create a function that contains the menu-building code
2. Register the above function using the “admin_menu” action hook
3. Create the HTML output for the page (screen) displayed when the menu item is clicked

It is that second step that is often overlooked by new developers. You cannot simply call the menu code described; you must put it inside a function, and then register the function.

Here is a very simple example of the three steps just described. This plugin will add a sub-level menu item under the Settings top-level menu, and when selected, that menu item will cause a very basic screen to display. Note: this code should be added to a main plugin PHP file or a separate PHP include file.

< ?php
add_action('admin_menu', 'my_plugin_menu');

function my_plugin_menu() {
  add_options_page('My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options');
}

function my_plugin_options() {
  if (!current_user_can('manage_options'))  {
    wp_die( __('You do not have sufficient permissions to access this page.') );
  }
  echo '< div class="wrap" >';
  echo '< p >Here is where the form would go if I actually had options.< / p >';
  echo '< / div >';
}
?>

Now,you looked this example, the function, my_plugin_menu(), adds a new item to the Administration menu via the add_options_page function. Note: more complicated multiple menu items can be added, but that will be described later. Notice the add_action line–that invokes the hook which “registers” the function, my_plugin_menu(). Without that add_action, a PHP error for “undefined function” will be thrown when attempting to activate the plugin. Finely, the add_options_page code refers to the my_plugin_options() function which contains the actual page to be displayed (and PHP code to be processed) when someone clicks the menu item.

The actual detail of these processes is described in more detail in the sections below. Remember to enclose creation of the menu and the html page in functions, and invoke the admin_menu hook to get the whole process started!
—//some code and english manual copy from http://codex.wordpress.org/Adding_Administration_Menus—
if you want to set an administration menu,you can see it..

wordpress开发的几个事项

1、自定义字段,详见 http://codex.wordpress.org/Using_Custom_Fields ,几个常见的方法有:
add_post_meta($id,$key,$value,$unique),update_post_meta,delete_post_meta
get_post_meta,get_post_meta_keys,get_post_meta_values
用于模版中的有,the_meta,get_post_meta

2、图片存在哪里?图片其实也是一条post数据,只是 post_type = attachment而己
其它post_type有,draft(草稿),revision(历史数据)等。
当图片的post_parent没有值时,认为它是孤立附件。如果有值是认为是有关联的,仅关联第一次,如果有多个文章插入此图片,默认只关联第一次的。

3、wp_links是友情链接表
wp_comments是回复表
wp_commentmeta和postmeta类似,但一般都用不到。
wp_options是系统配置表,可以用get_options等获取。
wp_terms等三个表是关联表,wp_terms里面存放了category,tag等信息
wp_users等两个表是用户相关表。由于usermeta信息是key,value对应的,所以当要取所有的用户及全部配置信息时就很郁闷。如果用户不多,建议是把wp_usermeta全部取出来之后,再用foreach等做键值对应,否则,SQL查询就会死人。

WordPress的插件开发全攻略(目录)

这篇文章是我转自sexywp.com的文章,有PDF版的下载哦,不过仔细看了之后,还是觉得比较简单,当然如果是初学的话,了解一下也足够了。

  1. How to Write a WordPress Plugin – Introduction
  2. 介绍
  3. Seven Reasons to Write a WordPress Plugin
  4. 编写插件的七个理 由
  5. How to Get Ideas for WordPress Plugins
  6. 怎样获得 WordPress插件的创意
  7. Structure of a WordPress Plugin
  8. WordPress 插件的结构
  9. WordPress Plugin Actions
  10. WordPress 插件Actions
  11. WordPress Plugin Filters
  12. WordPress 插件Filter
  13. Constructing a WordPress Plugin Admin Panel
  14. 构造一个 WordPress插件管理员面板
  15. Constructing a WordPress Plugin User’s Panel
  16. 构建一个 WordPress插件用户面板
  17. WordPress Plugins and Database Interaction
  18. WordPress 插件和数据库交互
  19. Using JavaScript and CSS with your WordPress Plugin
  20. 在你的 WordPress插件中使用Javascript和CSS
  21. Using AJAX with your WordPress Plugin
  22. 在你的WP插件中 使用AJAX
  23. Releasing and Promoting Your WordPress Plugin
  24. 发布并推广你的 WordPress插件

作者:Charles 原文链接:插件开发全攻略(目 录)

Yii framework documentation and api manual

When you wrote your php code with yii framewok,you must look the reference.so i try to find yii framework documentation and api manual.
Yii api manual is a chm file,so you can download it ,and you can write code for the reference.(又在乱写了。。。)
Yii documentation that gives the definitive description of every feature of Yii and is being constantly updated to reflect the latest enhancements and changes.it’s showed on Yii frontpage.This tutorial release also available by some languages.Chinese also among them.
if you want to find chinese manual ,please type the url:

http://www.yiiframework.com/doc/guide/zh_cn/index

and

http://dreamneverfall.cn/yiidoc/index.htm.

And you can also be downloaded in PDF format.
Over…