(For WordPress database functions see here) Prepared statements provide strong protection against SQL injection, because parameter values are not embedded directly inside the SQL query string. The server uses these values directly at the point of execution, after the statement template is parsed. ->bind_param() The first argument defines the input data, each character matches it […]
All posts by
TEXT or VARCHAR
Which is best? Put simply, use a VARCHAR field instead of TEXT for columns between 255 and 65k characters if possible as it will lead to potentially fewer disk reads and less writes. VARCHAR Max size of 65535 characters Uses 2+n bytes to store the value where n is the length of the stored string. […]
Lazy loading images
Browers now support the loading= attribute which allows you to specify if images should be lazy loaded: Options: “auto”Default lazy-loading behavior of the browser (same as not including the attribute). “lazy”Defer loading of the resource until it reaches a calculated distance from the viewport. “eager”Load the resource immediately, regardless of where it’s located on the […]
Sanitising Functions
esc_html() Translated text esc_html_e( ‘This is somewhat embarrassing, isn’t it?’, ‘kleo’ ); esc_url()
Category/archive page actions
The archive page is shown when a category is selected and typically has excerpts of each post in that category Category page hook Doesn’t work? Maybe your theme has overridden the default WordPress category pages with its own custom category page? Theme hooks Look in your theme’s archive.php (or category.php) file – does it have […]
Multi / single column depending on screen size
Example with 2 columns of boxes that change to a single column on small screens html css
YahnisElsts plugin-update-checker
This updater is great for auto updating of private plugins and also themes. Library links https://github.com/YahnisElsts/plugin-update-checker These notes are based on the excellent guide included on GitHub Should you use GitHub to host your plugin-update-checker releases? plugin-update-checker lets you create a release in GitHub and have that as where your files get hosted, nice and […]
Resources For Plugin Creation
Guides WordPress Plugin Handbook https://codex.wordpress.org/Writing_a_Plugin
Day Names
Get # day names from DateTime and into the past Get # day names from DateTime and into the future
Days until / Days Ago
$TimeNow examples User friendly how long ago Multi language version User friendly how long until Multi language version