20 likes | 40 Views
Semalt, semalt SEO, Semalt SEO Tips, Semalt Agency, Semalt SEO Agency, Semalt SEO services, web design, web development, site promotion, analytics, SMM, Digital marketing
E N D
23.05.2018 Semalt: WordPress Plugin Development Tips Plugins are codes that can be installed in the WordPress and have the ability to extend and expand the functionality of a site. It allows for this functioning without the necessity of hacking the core code. It allows the addition of features that can integrate Facebook Open Graph and Hotmail tags. Frank Abagnale, a top expert from Semalt, focuses here on a compelling practice in this regard. Creation of a Plugin The ?rst step is to create a new folder in the WordPress at this link "wp-content/plugins/" followed by creating a folder in it and name it "my-facebook-tags". The name of the plugin's folder is also known as plugin's slug which should be unique and can be obtained by searching on Google. The next step is creating a folder in the Facebook folder and naming it "my-facebook-tags.p"p". the following code should then be pasted inside the plugin's main ?le. After the creation of the plugin, it is necessary to create a hook in a theme namely "wp_head()". There are two types of hooks namely actions and ?lters. The difference between actions and ?lters is that actions operate when a hook has been detected by the WordPress whereas ?lters modify bits of data. To complete the plugin, it is necessary to add the facebook meta tags using the hook wp_head using the following code https://rankexperience.com/articles/article1954.html 1/2
23.05.2018 It is necessary to pick the right hook for use in a plot. Filters As earlier mentioned, ?lters are used to modify bits. It is, therefore, possible to change an error message that occurs when a wrong password has been entered. For instance, when a wrong password has been entered for www.example.com/wp-admin, the error message can be removed by entering the ?ltered data. For example in the following case; The ?lter is "login_errors". The error message is removed by entering the ?ltered data. Scripts and Styles can be added by enqueueing. An example is the addition of a Google font which is a form of a stylesheet. It is illustrated below; Assets can be loaded and stored in the plugin using enqueueing as shown below. Creation of a page for plugin settings There are several ways of creating a page but the most recommended one is the object-oriented approach. The ?rst step is to create a menu where settings user interface can be placed. The "add_menu_page()" is most suitable for creating the superior menu due to the following reasons: page title, menu title, capability, menu slug, function, icon, and position. The settings should then be registered. For example, if we want to register settings for an accountant we follow the following procedure. The next step is to create a form that will be responsible for displaying the user interface. This code shown below should be pasted inside the "my_plugin_settings_page()" ?eld. The following precautions should be taken The "settings_?elds()" should be used and the ?rst parameter added as the option group. And the names used in the parameters should be used in the option names ?eld. The "get_option()" function should be used to grab the value of a ?eld and placed as the ?rst parameter in the option name ?eld. The settings form created should look like the ?gure shown below. Although it is not necessary to enable translations, it can be useful at times. Translations are enabled using the following procedure. The following should be used to wrap text every time there are instances of outputting "__() function" or the "_e() function". https://rankexperience.com/articles/article1954.html 2/2