Articles - Page 2 of 4 - Ryan Kienstra

JavaScript variable declaration

JavaScript Variable Declaration

By: Ryan Kienstra on: January 24, 2015  in: JavaScript

Good PHP developers can learn basic JavaScript quickly. But JavaScript variable declaration is different from PHP. And forgetting declarations will cause subtle bugs, not errors. Variable Declaration Declare all variables by using var var myVariable = 'foo_string'; If you don’t, you’ll make the variable global. var scopeTest = function() { accidentalGlobal = 'The value inside […] Read more


oop inheritance icon

OOP Inheritance For WordPress

By: Ryan Kienstra on: January 20, 2015  in: OOP For WordPress

OOP inheritance allows powerful, reusable code. If you haven’t already, you might read my guides: OOP Fundamentals For WordPress OOP: Instance Vs. Static Rationale: Reusing Code Programming is largely about reusing code. Functions execute the same code every time they’re called. The only difference is the arguments. But inheritance in object-oriented programming is much more […] Read more


static-vs-instance

OOP: Instance Vs. Static

By: Ryan Kienstra on: January 18, 2015  in: OOP For WordPress

By understanding instance vs. static properties, you can write flexible code. And build complex object-oriented programs. If you aren’t familiar with classes and instances, you might read OOP Fundamentals For WordPress. Properties: Instance Vs. Static Instances can store variables called instance properties. They aren’t connected to properties of other instances. But instances can also access […] Read more


OOP Fundamentals

OOP Fundamentals For WordPress

By: Ryan Kienstra on: January 11, 2015  in: OOP For WordPress

You program for WordPress using PHP functions and variables. But you’d like to use object-oriented programming. Maybe you’ve read my guide, OOP With WordPress: Why? In writing functions, you’ve already used: OOP Fundamentals Abstraction Code Reuse Abstraction Functions often have private variables. They can be abstracted from the local scope. Nothing else can access them, […] Read more


OOP With WordPress gears

OOP With WordPress: Why?

By: Ryan Kienstra on: January 9, 2015  in: OOP For WordPress

You’ve been programming with functions and variables. And most of WordPress doesn’t use OOP. So why do you need object-oriented programming? Store variables between functions Reduce arguments Show structure Plugin Example My WordPress plugin Bootstrap Widget Styling filters the markup of widgets. Here’s how to do it without object-oriented PHP: add_filter( 'wp_list_pages' , 'bws_filter_pages_widget_markup' ); […] Read more


Fast WordPress Searches

Fast WordPress Searches

By: Ryan Kienstra on: January 8, 2015  in: WordPress VIP

If you have a lot of content on WordPress, you’ll need a fast way to search it. Maybe you have a directory with an advanced search. WordPress VIP agency 10up recently released their Engineering Best Practices. These have many techniques for fast WordPress searches. Prefer WP_Query To get_posts 10up explains that the get_posts function actually […] Read more


WordPress VIP Unique Standards

WordPress VIP: Unique Standards

By: Ryan Kienstra on: January 6, 2015  in: WordPress VIP

Many of the VIP coding standards are different from self-hosted WP standards. The size and structure of VIP multi-sites often require different coding. Users There’s a single database for all users in WordPress.com. So you can’t do any CRUD operations on it: create, read, update, or delete. To parse the users, call get_users() and operate […] Read more


WordPress VIP caching

WordPress VIP Caching

By: Ryan Kienstra on: January 5, 2015  in: WordPress VIP

Many of the WordPress VIP coding standards¬†are meant to ensure that caching works. So these standards can help most sites that use caching. Batcache is the full-page caching system that WordPress VIP sites use. After a set number of requests for the same page, it saves a copy and serves it to new visitors. It […] Read more