Posts
12
Comments
180
Trackbacks
0
WordPress 101 - Plugins!

This blog series covers just a few of the many features of WordPress from a developer's perspective.



"WordPress powers over 25% of the internet..."

If you've never heard of WordPress, you can think of it as the king of content management systems (CMS), allowing individuals and businesses to build and maintain robust websites with relative ease and with very little to no developer experience required. WordPress has a very flexible framework that allows for 3rd party developers to create "themes" and "plugins" that website owners can download and install with most freely available. Themes allow you to completely change the look and feel of your website with the click of a button and Plugins add functionality ranging from full blown online stores to hooking into Google Analytics... really just about anything you can think of.

This article will focus on creating a simple plugin that will display a modal dialog when a user first visits your WordPress site.

NOTE: You may want to download the full sample to be able to more easily follow along.

http://www.holisticstg.com/HolisticsTG_WP_Plugin.zip

What is a WordPress plugin?

"A WordPress Plugin is a program or a set of one or more functions written in the PHP scripting language, that adds a specific set of features or services to the WordPress site. You can seamlessly integrate a plugin with the site using access points and methods provided by the WordPress Plugin API."

From a traditional developer view, what this really means is that this gives us the ability to hook into the framework and extend the base functionality to do nearly anything we want. 

So for example, say you have a client that needs to have their Google Analytics data displayed on an admin area of their website for the regional managers to review. Lucky for you there's a wonderful plugin already created for that and all you have to do is click a few buttons to install/configure and now you're looking like a boss! 

Or say your client tells you they want to capture more leads by asking site visitors to register with their newsletter when they first come to their site. Well I'm sure there's already a plugin that exists to do exactly that, however we'll use this requirement as the basis for our example (minus the newsletter part).

If you have downloaded the sample plugin, let's go ahead and get that installed on your development instance of WordPress, otherwise you can skip ahead to the "Files and Locations" section.

In WordPress, click on the "Plugins" option, or hover and then select "Add New"


Then click "Choose File" and navigate to where you downloaded the sample .zip file and then click "Install Now"


After a few moments, you'll see the following message... let's go ahead and activate the plugin while we're here


Now you'll see our new plugin listed




Files and Locations

All WordPress plugins and associated files are located in the wp-content/plugins/ folder.  For our example, you'll find our files in wp-content\plugins\holisticsTG. In there you'll find one file and one directory that contains 2 more files.

  • holisticsTG.php - our main 'entry point' file if you will for our plugin
  • includes/settings.php - handles saving the options that our plugin uses
  • includes/showpopup.php - does the work of displaying the modal dialog

holisticsTG.php

This file contains the required documentation/metadata as well as the initial code to get our plugin up and running. You'll notice at the top of the file, in the comments section, there is various information that is required by WordPress.


WordPress allows developers to wire into existing "actions", which are simply PHP functions that are executed at specific points throughout the page load/life-cycle. For example there is an action ("wp_footer") that allows you to "hook" into the action so that you can have your own custom function execute when footer information is being displayed.

So the first thing going on here is that the "__construct()" method, which is always called while our plugin is active, is where we are wiring up our functions to hook into existing actions.

So for our example, we need to be able to 1.) display a link in the admin section to allow for customization of our plugin and 2.) add our code that displays the modal dialog when users first visit the site. To display a customization link in the admin menu, we will hook into the "admin_menu" action and for our modal dialog we'll hook into the "wp_loaded" action which essentially allows our modal dialog code to run once WordPress is fully loaded. 

The 'htg_add_menu' function creates a link within the admin section that, when clicked, displays a page that is driven by our "settings.php" file.

The 'htg_wp_loaded' function tells WordPress to execute our "showpopup.php" file every time a page is loaded and WordPress has been fully loaded and ready.

settings.php




showpopup.php




Now that we have our proper files in place, you'll see a link in the admin menu:


Clicking this will display our settings page where the user can configure the text to be displayed in the modal dialog as well as set the plugin to be active or not.



That's it! So now our modal dialog will be displayed only once for each site visit.



For more detailed information visit the WordPress.org support site.



posted on Wednesday, June 21, 2017 7:45 AM Print
Comments
Gravatar
# re: WordPress 101 - Plugins!
Jacob
6/23/2017 6:50 AM
amazing sharing. Thank you for sharing it.
Gravatar
# re: WordPress 101 - Plugins!
Terry Coetez
6/23/2017 9:44 AM
Nice Post.
https://www.snaptubeappz.com/snaptube-for-pc/
Gravatar
# re: WordPress 101 - Plugins!
<a href="https://192168-ll.com/"
6/23/2017 10:58 PM
Nice share! You can seamlessly integrate a plugin with the site using access points and methods
Gravatar
# re: WordPress 101 - Plugins!
UAN Activation Process
6/26/2017 2:40 AM
very nice plugin. can someone tell me how to use it on my website
UAN Activation Process
Gravatar
# HAITSTYLES
anuj
7/3/2017 3:37 AM

Mens haircuts
THANKU
Gravatar
# re: WordPress 101 - Plugins!
Daniel
7/4/2017 6:37 AM
i have question
how can we hide our source page from others
Mcafee Helpline Number
Gravatar
# re: WordPress 101 - Plugins!
Hair Cuts Eugene
7/11/2017 1:44 AM
This seriously is amazing and will be used for my business website lol
Gravatar
# re: WordPress 101 - Plugins!
Sania Khan
7/14/2017 2:26 AM
Thanks for sharing this post
Check Hollywood 18+ Movie
Gravatar
# re: WordPress 101 - Plugins!
MPSC ASO PSI STI 16/7/ 2017
7/19/2017 1:37 AM
visit here
MPSC ASO PSI STI 16/7/ 2017
Gravatar
# For Epson Printers|1-844-653-8777|Epson Printer support
Epson Support Number
8/11/2017 3:12 AM
Thanks for sharing your valuable features and other relevant information.
Epson Support
Epson Support Number
Gravatar
# re: WordPress 101 - Plugins!
anuj
8/16/2017 3:00 AM

[url=http://printablecalendarpro.com/september-2017-printable-calendar-for-free/]september 2017 printable calendar[/url]
Gravatar
# re: WordPress 101 - Plugins!
chelsieanayas
8/30/2017 11:05 PM
I would be happy if you could help us. I hope my site will be Google accepted and put it ahead so that I can grow and hope that it will come to me.
dumb ways to die
fireboy and watergirl 4
Gravatar
# re: WordPress 101 - Plugins!
Helen Honore
9/10/2017 8:05 AM
Thanks for good news! I could not wait for this update. I hope that in this version we get additional functions belong to content working.

Thanks,
https://essayservicewriter.com/
Gravatar
# re: WordPress 101 - Plugins!
Helen Honore
9/10/2017 8:06 AM
Thanks for good news! I could not wait for this update. I hope that in this version we get additional functions belong to content working.

Thanks,
http://essayservicewriter.com/
Gravatar
# re: WordPress 101 - Plugins!
Helen Honore
9/10/2017 8:07 AM
Thanks for good news! I could not wait for this update. I hope that in this version we get additional functions belong to content working.

Thanks,
https://essayservicewriter.com/
Gravatar
# Camron Daina
Camron
9/13/2017 1:43 AM
list of best watercolor tattoos is http://tattoosboygirl.com/watercolor-tattoos/ here
Gravatar
# Kaspersky Support US +1-888-274-2621 Kaspersky Support Number
Kaspersky Support Number
9/18/2017 3:22 AM
nice post, thank you.
http://kaspersky-support.net/

Gravatar
# re: WordPress 101 - Plugins!
Kaspersky Helpline Number
9/18/2017 3:24 AM
superb post.
Kaspersky Support Number
Gravatar
# re: WordPress 101 - Plugins!
Govt Jobs 2018
9/19/2017 1:47 AM
visit here for more detail about govt jobs in India
Gravatar
# Epson Support +1-888-274-2621 Epson United State
Epson Helpline Number
9/23/2017 4:27 AM
hii Very amazing post, thank you.
Epson Support
Gravatar
# re: WordPress 101 - Plugins!
skype login
10/15/2017 10:08 PM
Thanks for sharing these useful information! This is really interesting information for me.
skype login
Gravatar
# re: WordPress 101 - Plugins!
flip diving
10/22/2017 9:17 PM
Your site has a lot of useful information for myself. I visit regularly. Hope to have more quality items.
Gravatar
# re: WordPress 101 - Plugins!
kevinpaul
11/8/2017 10:56 AM
very nice plugin. can someone tell me how to use it on my website

UAN Activation Process
Gravatar
# Yahoo Support US +1-888-256-1771 Yahoo Helpline Number
Yahoo Customer Support
11/11/2017 3:43 AM
Awesome Post, thank you.
Yahoo Support Number
Gravatar
# re: WordPress 101 - Plugins!
alastair
11/23/2017 6:32 AM
Thank for posting this excellent article.
Gravatar
# re: WordPress 101 - Plugins!
quotesbunch
12/2/2017 5:42 PM
that was a great innovation in terms of user experience.
quotesbunch
Gravatar
# Hp Laptop Support Number
Hp Laptop Helpline
12/12/2017 4:35 AM
Nice Post.
Hp Laptop Support Number
Gravatar
# McAfee Support Number +1-888-600-7520 Toll Free
McAfee Customer Support
12/18/2017 7:02 AM
Contact McAfee Support Number +1-888-600-7520 and get Mcafee Antivirus Support services to resolve your specific problems related to the Mcafee Antivirus.
McAfee Customer Support
Gravatar
# re: WordPress 101 - Plugins!
sujen
12/27/2017 12:22 AM
Nice post share.
website designing company in delhi
Gravatar
# re: WordPress 101 - Plugins!
maitri kheni
1/9/2018 5:36 AM
that was a great innovation in terms of user experience. happy use this website free gift card generator
Gravatar
# re: WordPress 101 - Plugins!
Anna Shetty
1/10/2018 3:12 AM
we found that the pictures taken with front camera were really higher quality than anticipated good details, vivid shading and minimal noise. Even in low light, the camera managed to take selfies. cool math games
Gravatar
# Yahoo Helpline Number +1-888-600-8505 Toll Free
Yahoo Customer Support
1/15/2018 1:48 AM
Great Post.
Yahoo Customer Support
Gravatar
# re: WordPress 101 - Plugins!
Alisha
1/20/2018 4:24 AM
I am delighted to read this post and all the details are awesome in this post.
Vip Agency Escorts
Gravatar
# Orthodontist
Kannu
2/5/2018 5:08 AM
I'm really happy to see this post. Orthodontist in Vasant Vihar
Gravatar
# Cleaning Services
Rahul
2/5/2018 5:11 AM
Amazing post you have made their. Keep going like this. best home cleaning services in delhi
Gravatar
# BuyEssayWriting
Renado
2/7/2018 6:35 AM
Getting an education is great. In this you can help buyessaywriting. They will cope with any difficult topic for you.
Gravatar
# re: WordPress 101 - Plugins!
hanan ramy
2/19/2018 10:10 AM
Thank you
You can visit our website He specializes inmoving furniture
نقل عفش جدة http://ebad-rahman.blogspot.com/2017/02/transfer-jeddah.html
Gravatar
# re: WordPress 101 - Plugins!
hanan ramy
2/19/2018 10:11 AM
Was very good post
Thank you
You can visit our website He specializes inmoving furniture
نقل عفش جدة نقل عفش جدة
Gravatar
# re: WordPress 101 - Plugins!
hanan ramy
2/19/2018 10:13 AM
Was very good post
Thank you
You can visit our website He specializes in moving furniture
افضل شركات نقل العفش بجدة
Gravatar
# re: WordPress 101 - Plugins!
hanan ramy
2/19/2018 10:13 AM
Was very good post
Thank you
You can visit our website He specializes in moving furniture
اسعار شركات نقل العفش بجدة
Gravatar
# Tile Adhesive, Wall Tile Adhesive
honey
2/21/2018 2:07 AM
all information about adhesive products
Gravatar
# Tile Adhesive, Wall Tile Adhesive
honey
2/21/2018 2:09 AM
all information about adhesive products Tile Adhesive

Wall Tile Adhesive
Gravatar
# Popular mobiles reviews Expert
mymobtech
2/26/2018 4:26 AM
All kind information mobiler reviews visit here
Popular mobiles reviews Expert
Gravatar
# Kaspersky Support US +1-888-600-7520 Kaspersky Helpline Number
Wilson Anni
3/13/2018 5:10 AM
Dial +1 888-600-7520 Kaspersky Helpline number in USA for technical problems and get fixed your issues Kespersky antivirus installation, renew, setup by expert technician.
Kaspersky Support
Gravatar
# re: WordPress 101 - Plugins!
jessicasmith
3/15/2018 8:13 AM
hlo every one how are you.
carhartt
Gravatar
# GreenGeeks promotional deals
Carywatson
3/16/2018 4:13 AM
I read deeply your article, the points you have mentioned in this article are awesome Thanks!
If you are looking for web hosting service GreenGeeks give faster speed, better security and best customer support.
GreenGeeks promotional deals
Gravatar
# re: WordPress 101 - Plugins!
David
3/22/2018 11:35 AM
You can check here top SEO plugins for WordPress. Install them and boost ranking in all search engines.
Gravatar
# online shopping saving coupons
Pole Smith
3/24/2018 5:54 AM
You have a genuine capacity for composing extraordinary Stuff. It is a fantastic blog its really inspiring and full fill with knowledge. keepit up.
Active Target Discount Coupons
Gravatar
# re: WordPress 101 - Plugins!
sosoqqq sosoqqq
3/24/2018 10:57 AM
ll➤ Large choix de Cuissards Running Homme en stock ✅ Alltricks le distributeur N°1 de vos Cuissards Running à prix imbattables livrés en 24/48h !
adidas busenitz femme pas cher

Gravatar
# re: WordPress 101 - Plugins!
dan jackson
4/18/2018 6:53 AM
Easy background check. Results in just 60 seconds!
Gravatar
# re: WordPress 101 - Plugins!
Nikos Nikitas
4/24/2018 4:10 AM
SPYTECH.BG е онлайн магазин за шпионска техника предлагащ скрити камери, безжични камери, мини камери, видеорекордери, бръмбари за подслушване, GPS проследяване (тракъри), детектори за бръмбари, GSM заглушители, грим за дегизировка (театрален - бради, мустаци, бои за коса, комплекти за състаряване), ножове, електрошокове, метал детектори, хеликоптери и самолети с дистанционно управление и възможност за монтиране на камери.
spy shop in greece

spy store in romania
Gravatar
# re: WordPress 101 - Plugins!
apple support mchelper
5/1/2018 1:39 AM
Hi, nice article. I have been pondering concerning this matter, so thanks for sharing.
Apple Support Mchelper
Mchelper Australia
Gravatar
# re: WordPress 101 - Plugins!
mac support
5/1/2018 1:42 AM
This was a great and interesting article to read. I have really enjoyed all of this very cool information With sincerity and admin of a site, take the time to present important information to the visitors.mac support
mac help
Gravatar
# re: WordPress 101 - Plugins!
iphone help
5/1/2018 1:47 AM
Wonderful post!!! Genuinely loved this kind of post. Although I want much more information on like precious subject matter.
Gravatar
# re: WordPress 101 - Plugins!
iphone help
5/1/2018 2:16 AM

iphone help
apple iphone support
Gravatar
# re: WordPress 101 - Plugins!
apple help
5/1/2018 2:18 AM
Thanks for publishing this details. I simply wish to let you know that I just look into your site and also I locate it really fascinating and useful.
apple help
apple help number
Gravatar
# re: WordPress 101 - Plugins!
apple support
5/1/2018 2:21 AM

apple support
apple support number
Gravatar
# web designing company delhi
esteps technologies
5/1/2018 7:36 AM
Great Blog you have share such a important information Worth reading Keep writing. web designing company delhi.

Post Comment

Title *
Name *
Email
Comment *  
Verification
Coding strategies for the Java and .Net developer...