Wordpress Custom Plugin

Worpress Custom Plugin

Basics Plugin | Plugin Development Guide It is strongly advised that you set up a folder in which to store your plugin so that all the plugin related data is clearly organised in one place. In order to start the creation of a new plug-in, please perform the following procedure. Go to the plugin folder. Make a new folder and name it after your plugin (e.g.

Plugin-Name).

Go to the folder of your new plugin. Make a new PHP filename (it is also good to name this filename after your plugin, e.g. plugin-name.php). As you edit the PHP of your new plugin, you need to make a comments to the plugin headers. It is a special PHP formated bloc annotation that contains meta data about your plugin, such as name and creator.

As a minimum, the comments in the plugin headers must contain the name of your plugin. There should only be one filename in the plugin directory that has the comments headers - if your plugin has more than one PHP filename, only one of these filenames should have the comments headers. Now your new plugin should be in this listing!

There are 3 main checkmarks you need when you create a plugin: register_activation_hook(), register_deactivation_hook() and register_uninstall_hook(). Enable check mark will be executed when you enable your plugin. This would be used to create a feature to configure your plugin, e.g. to create some defaults in the option chart.

Unchecking will be executed if you disable your plugin. They would use this to deploy a feature that deletes all of your plugin's temp memory. They would use this to erase all information generated by your plugin, such as all option values added to the option list.

With do_action( ), you can create your own custom hook, which allows designers to expand your plugin by routing features through your hook. If your plugin is an add-on to another plugin, for example, you can use remove_action() with the same feature recall added by the prior plugin with add_action().

For more information about how to create and interact with hook, see the Hook section of this guide. Those APIs can make the coding you need to build into your plug-ins much easier. Most commonly, the Options-API makes it simple to save files in the plugin databases.

Remembering to use it in your plugin, the HTTP API might be of interest to you. As we are discussing plug-ins, you should take a look at the Plugin API. There are a lot of features that support you in the development of plug-ins. So if your plugin as a whole is just a PHP executable, like Hello Dolly, the executable could be directly in the plugin folder's home directory.

However, more often plugin executables are located in a separate directory called after the plugin. Occasionally, a plugin that you build is intended only for your website. You must select a licence before releasing your plugin. In this way, the plugin users learn how to use your plugin source codes.

Auch interessant

Mehr zum Thema