PHP – Start create a plugin for WordPress.

A plugin can add new features to any part of your website, including the WP-Admin-Panel.
You can change the default behavior of WordPress, or remove the functionality/functions completely.
Plugins allow you to customize the WordPress site without touch your actual WordPress code.
WordPress plugins are standalone, they do not physically alter any of the WordPress core code.
A plugin can be made up of a single PHP file or multiple files like images, JavaScript, language, CSS files.
It’s recommended that WordPress developers name their main plugin file after their plugin by convention with a unique name.

In my example, I named the plugin WP_mythcat plugin would be wp-mythcat.php .
After you develop all the code for a plugin you then compress your main folder into a zip file to be uploaded and installed on a WordPress site.
Then you can install from your WordPress website.
The main PHP plugin file comes with a header with the standard plugin information header at the top of your main PHP file.
Example:

WordPress Plugins interact with core code using hooks.
There are two different types of hooks.
Action hooks to add/remove functions
Filter hooks to modify data that is produced by functions
Let’s see some examples with hooks:

The next source code will add the mythcat settings plugin into admin main menu with all HTML5 inputs.
You need to change this new_option_name for each input tag used.
Let’s see the source code, is very simple:

This is the result of the source code, see the screenshot:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.