- WordPress 3 Plugin Development Essentials
- Brian Bondari Everett Griffiths
- 237字
- 2021-04-09 21:19:57
Deconstructing an existing plugin: "Hello Dolly"
WordPress ships with a simple plugin named "Hello Dolly". Its name is a whimsical take on the programmer's obligatory "Hello, World!", and it is trotted out only for pedantic explanations like the one that follows (unless, of course, you really do want random lyrics by Jerry Herman to grace your administration screens).
Activating the plugin
Let's activate this plugin so we can have a look at what it does:
You should now see a random lyric appear in the top-right portion of the Dashboard. Refresh the page a few times to get the full effect.
Examining the hello.php file
Now that we've tried out the "Hello Dolly" plugin, let's have a closer look. In your favorite text editor, open up the /wp-content/plugins/hello.php
file. Can you identify the following integral parts?
- The Information Header which describes details about the plugin (author and description). This is contained in a large PHP /* comment */.
- User-defined functions, such as the hello_dolly() function.
- The
add_action()
and/oradd_filter()
functions, which hook a WordPress event to a user-defined function.
It looks pretty simple, right? That's all you need for a plugin:
- An information header
- Some user-defined functions
add_action()
and/oradd_filter()
functions
Now that we've identified the critical component parts, let's examine them in more detail.
- vtiger CRM Beginner's Guide
- 架構之美
- AutoCAD 2020中文版從入門到精通(標準版)
- 3ds max & VRay產品造型設計經典
- Illustrator CS6核心應用案例教程(全彩慕課版)
- Maya建模技術解析
- 印象筆記留給你的空間2.0:個人知識管理實踐指南
- iPhone User Interface Cookbook
- 新印象:CINEMA 4D電商設計基礎與實戰(全視頻微課版)
- CorelDRAW X6核心應用案例教程(全彩慕課版)
- AutoCAD 2022中文版完全自學一本通
- 會聲會影X8 DV影片制作/編輯/刻盤實戰從入門到精通
- Adobe Premiere Pro CC 2019經典教程(彩色版)
- 中文版After Effects 2020基礎教程
- Excel效率手冊:早做完,不加班(圖表篇)(升級版)