== vs === – IMPORTANT FOR STRINGS!!!!! When comparing a string to an integer the string is evaluated as 0!! evaluates true because first “ABC” is converted to integer and becomes 0 then it is compared to 0. Use === if you are comparing non strings to a string value
All posts by
Working with directories
Create a directory it doesn’t already exist
Plugin namespace
Creating a plugin inside a namespace By using a namespace, everything inside the namespace does not need globally unique naming prefixes, solving clashing issues with other plugins, themes and wordpress itself. Using a namespace is much simpler than using a class for your plugin. Add all your php files to the namespace Add this to […]
Plugin class
Creating a plugin inside a class By using a class, everything inside the class does not need globally unique naming prefixes, solving clashing issues with other plugins, themes and wordpress itself. BUT, in PHP a class has to be contained in a single file, you can’t split a class across multiple files. You can create […]
Plugin hooks
Plugin activated
Distribute Your Plugin
zip the plugin folder, including the root folder named as your plugin. The name of your zip can be anything, but is typically the name of your plugin too, possibly with a version number at the end if you want that..
.Create New Plugin
The basics Decide on a name for your plugin, this must be globally unique. Create a folder in the wp-content/plugins/ directory using your plugin name.Use lowercase and replace any spaces with hyphens. Create a file in the folder with the exact same name as your plugin folder, with the “.php” extension.This is the master file […]
Border as seperator
Creating a line that is thinner than its parent
Combined values
Values order: Top Right Bottom Left
Converting Form Text Fields
filter_var() function Returns the input string filtered into the required typ, or FALSE if it was unable to perform the sanitization (e.g. due to illegal characters etc) See here for all the available filter options. Example – INT Sanitising for HTML from a form POST If server magic quotes is turned on then it will add / […]