Tag: wordpress

WordPress Plugin Overview

 

The WordPress content management system is very versatile for creating blogs and websites. Installed, it comes with basic features and plugins. However, in order to expand its functionality, we need to use plugins. There are plugins that provide a variety of functionality including: SEO, backup, security, eCommerce, analytics, contact forms, etc. Many of these types of plugins are available for free or for purchase. However, if you need a function to be accomplished that the existing plugins do not offer, then you can write a plugin.

What are the characteristics of a plugin that make it unique? First of all, the code is written in php, html, css and javascript. Most or all of these languages are necessary for writing functionality from scratch. But if you want to make this functionality operate in WordPress, it is necessary to use hooks in your code.

What are hooks? Hooks are functions that reference internal functions in Word Press. First thing to know is that when a WordPress web page loads or is refreshed, a number of internal functions execute. You will not see these functions execute unless there is a problem with their execution.

For instance, when the page loads, one of the internal functions is admin_notices. The purpose of this function is to display notices in the header area of the admin area, if there are any to be displayed. If you want to display text in this area it is necessary to use an add­­_action hook. Syntax is shown below …

add_action( ‘admin_notices’, ‘function_name’);

Let’s say that the said function_name uses HTML to echo a character string. When the page is refreshed and the admin­_notices function is encountered in the wordpress page execution, then the execution of the said function_name is added to it. Therefore, the character string that the function echos will display in the admin_notices area.