WordPress is carefully designed so plugins we third party can easily customized it without editing the core files. Editing the core files is not recommended because if you do, you can no longer update the WordPress core or you will lose all the edits. The best way to edit the default functionality or add new one is to create a new WordPress plugin.
Common Functionality A Plugin Can Do:
- create or define a new shortcode – If you want to make a plugin that will accept links of social media in the dashboard and you may want a shortcode that can be inserted in posts, pages, or widgets
- add metaboxes to hold custom fields for each posts or pages
- create a widget
- define custom cron jobs
- add custom menus and submenus with corresponding pages in the dashboard
- add custom post types
- and it can handle combination of simple or complex tasks
How WordPress Core Read Your Plugin?
If your plugin is activated, WordPress core will include the path to your plugin in the list of active plugins, e.g., my-plugin/my-plugin.php. This means that if it is active and you will change the folder name or the file name, WordPress automatically deactivates it. Once the plugin is active, the core will read the main plugin file or the php file that contains the code snippets below.
If plugin codes needs to be organized on different files and folders, you need to include the path of those files in the main plugin file.
First, create a folder under the plugins folder. The name should be related to the kind of plugin you’re going to make. Then create the main plugin file under the created folder. The top section of the file should contain the ff. codes and enter the appropriates details of your plugin.:
/** * Plugin Name: * Plugin URI: * Description: * Version: * Author: * Author URI: */
You can determine that you did correctly, by going to the dashboard -> plugins. If you see the name of your plugin in the list, click activate. If no error occurs, then you’re doing well.
Depending on the complexity of your plugin’s functionality, you can create sub folders and organize the files appropriately. A plugin can do simple to complex task(s). It can do certain actions in the admin, front end, or both.
Whatever you want your plugin to do, the rest will already be using your knowledge in php, html, jquery, etc.