- 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.
- UG NX 8.0基礎(chǔ)與實(shí)例教程
- UG NX 9.0中文版 基礎(chǔ)教程 (UG工程師成才之路)
- 中文版Premiere Pro CC實(shí)用教程
- SolidWorks2014基礎(chǔ)實(shí)例教程
- Cinema 4D電商美工與視覺(jué)設(shè)計(jì)案例教程(培訓(xùn)教材版)
- Adobe創(chuàng)意大學(xué)After Effects產(chǎn)品專(zhuān)家認(rèn)證標(biāo)準(zhǔn)教材(CS6修訂版)
- Cinema 4D完全實(shí)戰(zhàn)技術(shù)手冊(cè)
- Illustrator 2024從入門(mén)到精通
- Photoshop數(shù)碼攝影后期處理技法從入門(mén)到精通
- Adobe創(chuàng)意大學(xué)Photoshop CS5 產(chǎn)品專(zhuān)家認(rèn)證標(biāo)準(zhǔn)教材
- 巧學(xué)巧用Flash CS6制作動(dòng)畫(huà)
- Photoshop移動(dòng)UI設(shè)計(jì)從入門(mén)到精通
- 神奇的中文版Photoshop CC 2017入門(mén)書(shū)
- 3ds Max/VRay印象燈光/材質(zhì)/渲染技術(shù)精粹Ⅲ
- 中文版UG NX 7.0基礎(chǔ)教程