没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
试读
43页
这是在国外博客下载的一个讲解如何开发WordPress插件的系列文章,已经被作者制作成了PDF版本,我下载这个版本后,为其添加了书签,便于索引。而且,目前我本人正在翻译这个系列文章。感兴趣的朋友请去我的博客 www.charlestang.cn 查看,欢迎光临!或者,您可以再稍等一些时日,等我完全翻译好了,我也会制作PDF版本来上传的。
资源推荐
资源详情
资源评论
About this series:
How to Write a Wordpress Plugin
, written by Ronald Huereca is an extensive, twelve
part series on the process of creating your own Wordpress plugin. Every step is covered,
from “
Seven Steps for Writing a Wordpress Plugin
” all the wa
y down to adding ajax to
your plugin and releasing it. This is an excellent article series for anyone interested in
the process behind creating your very first Wordpress plugin. With code examples to
help assist you, you will be on your way to future relea
ses of your own plugins for the
Wordpress community.
About the author:
Ronald is frequently found laying his thoughts out in strong, straight
-
forward articles on
various web related topics. He comes from a relatively strong technical and business
backgrou
nd, having an undergrad in Electrical Engineering Technology and a Master of
Science in Business Administration. A programmer by day, and web hobbyist (and
writer) by night, who also runs his own blog at
www.ronalfy.c
om
. Ronald has been on
the Devlounge team since the fall of 2006, and has contributed many wonderful articles,
including this very wordpress series. He also writes for Weblogtoolscollection.
Introduction
For any
WordPress
user, plugins are essential.
WordPress Plugins
allow those with little
to no programming skills to extend the functionality of their blog. Plugins come in all
shapes and sizes, and there is a p
lugin that does just about anything for WordPress.
As good as WordPress is as a standalone application, there are still things that
WordPress lacks. Users are requesting more and more features for WordPress that
would be very feasible to write as a plugin.
There are many untapped ideas out there,
and new ones created every day.
Having released three plugins already (not counting the custom ones I wrote), I am
aware of some of the limitations of WordPress and wish to share some of the lessons I
have learned
(and am still learning) about creating WordPress plugins. As a result, I will
be starting series that will discuss various topics regarding writing your own WordPress
plugin. The series will start off very introductory and will assume your plugin knowledge
is zilch.
Who is this Series For?
This series is for any WordPress user who is curious about or wants to learn how to
write their own WordPress plugin. Readers of this series will have an intermediate
knowledge of PHP, know a little JavaScript, and be d
ecent at Cascading Style Sheets.
This plugin series will benefit theme designers, those that like to tinker with plugin code,
and those that are interested in writing their own plugin from scratch.
Tools to Get the Job Done
To write plugins, any text editor will do. Here are the tools I personally use to create
plugins.
Dreamweaver
Firefox
Firebug Firefox Extension
Web Develo
per Firefox Extension
XAMPP
with a local
WordPress
installation
This series assumes you have WordPress 2.1.x or greater installed.
Code Samples
All code I
use will be available for download after each post in the
Conclusion
section. I
will be building the code as I go along, so each download will be different. I will be
creating a plugin that doesn’t really do anything other than to show you the basics of
ho
w a plugin works.
Since each post in this series builds on top of each other, it is recommended to read this
series in the order it is presented.
I highly recommend not using the test plugin on a production WordPress installation.
Instead, use a
local WordPress installation
.
Topics
I plan to start off really basic and move quickly into the more hard
-
core WordPress
plugin functions. This series will not be a comprehensive mi
cro
-
detail of plugin
development, but will hopefully give you a nice foundation to start your own plugin
development. If you have any questions or suggestions, please leave a comment or e
-
mail me using the
De
vlounge contact form
(Ronald). I do ask that you not rely on
Devlounge for support and instead use the
WordPress Support forums
.
Techniques
Some of the techniques I use in my code samples may not be th
e best way to present
code and you may be cringing because I don’t have a lot of shortcuts. I apologize in
advance. Everybody has a different coding style.
As far as plugin techniques, structure, behavior, and other nuisances, if there is a better
and easi
er way that I overlooked, I am all ears (er, eyes).
Seven Reasons to Write a Wordpress Plugin
While writing the “How to Write a Plugin” series, I thought it would be beneficial to list
some reasons why WordPress users would want to write a
WordPress plugin
in the first
place.
Listed below are seven reasons why a WordPress user should consider writing a
WordPress plugin.
You like a plugin’s idea, but don’t like the plugin’s implementation
Whether discoveri
ng WordPress plugins on
Weblog Tools Collection
, the official
WordPress plugins directory
, or the
WordPress Plug
in Database
, you will inevitably find
a plugin that meets your needs
—
sort of.
You like the idea of the plugin, but not really the approach the plugin author took with it.
Why not run with the original idea and create your own separate version?
You want
to modify existing plugin code
Sometimes the plugin’s output needs to be tweaked a little bit or some functionality you
would like is missing. You can try convincing the plugin author to add your feature, but
plugin authors are usually quite busy or they
may not like your suggestion. It takes a lot
of effort by a plugin author to provide support and field feature and bug requests for a
plugin that is free. Sometimes the plugin is no longer supported by anyone.
In the event the plugin author is unable to y
our needs, it will be up to you to take the
initiative and modify the existing plugin code. If you do a good enough job and make
enough changes, you can re
-
release the plugin as long as the original plugin was
released under a
GPL compatible license
.
Usually one of the first things I do when I install or test a new plugin is to look at the code
and see what I can modify, what I can’t modify, and what I can possibly ad
d or take
away.
You want to extend a plugin
Sometimes a plugin is good as it is, but you would like to build upon it and release your
own version. For example, you may think a plugin would work better using AJAX, or
would like to add more hooks so that it
is compatible with other plugins. You may want to
add an admin panel so you don’t have to dig through the code to change the output.
As stated earlier, if a plugin is released as
GPL compatible
, you are free to release your
own version.
You want portable theme code
For those of us who opted to build a custom theme from scratch rather than download
one, you may find yourself re
-
using code snippets all over the place. W
ouldn’t it be
better just to write your own plugin that combined all the little code snippets so that you
could use them as template tags?
The beauty of template tags is that you can re
-
use them over and over for your theme
and any future ones you build.
And you only have one place to change the code rather
than several.
You are a theme designer
I would argue that if you are a template designer for WordPress, the next logical step is
to be a plugin author. Writing plugins gives you a more intimate knowledg
e of how
WordPress behaves and allows you to extend the functionality of your released themes.
You want to make money
A good plugin author can usually get paid on the side for custom work. Some plugin
authors take donations as well or charge extra for prov
iding support or for consulting.
If you are a custom theme designer, you can package your custom plugins in with the
theme for an extra charge.
You want incoming links
When launching the
Reader Appreciation Project
, one of the goals I had was to rapidly
build incoming links. The best way I knew how was to write some WordPress plugins
and promote them. One of my plugins (
WP Ajax Edit Comments
)
turned out to be very
popular and has currently generated more than 100 incoming links.
剩余42页未读,继续阅读
资源评论
Charles@TechBlog
- 粉丝: 502
- 资源: 18
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功