In object-oriented PHP, inheritance is the ability to create a class that extends another class and takes on some or all of its features. This is one of the most useful functions of object orient programming in PHP (OOP PHP). I’ve skimmed over it in several of my recent articles on OOP in PHP, but in this article, I want to take a deeper look at class inheritance, how to use it, and why it’s important. Class Inheritance The first time I tried to write a really big WordPress plugin, I had four main classes that dealt with four different […]
It’s Time To Level Up Your PHP Skills
A few years ago I was working on a WordPress-powered web application that used several custom post types, each of which required a different class to query it. The classes included a lot of repetitive code because the queries and a lot of other things I was doing was different. Somewhere during this project, I noticed that the pattern I established and cut and pasted across four different classes was very wrong. I recently came across my first Carl Alexander article on polymorphism in PHP, which introduced me the concept of abstract classes in object-oriented PHP. I re-read the article […]
Understanding The Concept Of Visibility In Object Oriented PHP
I’ve been writing a lot recently about principles of object-oriented programming (OOP) in PHP, including magic methods. OOP is great in that it promotes encapsulation of code: separated functions, classes, and methods — each with their own scopes and purposes. The rules of how we access properties, variables, and methods from different encapsulated scopes are determined by visibility. In this article, I will explain how visibility is defined, how it works, and why it is important in OOP PHP. Keep in mind that this article refers to how these principles work in PHP 5.4 or later. PHP 5.3 and below […]
What WordPress Developers Need To Know About PHP Magic Methods
Chances are, if you’ve looked at PHP code, you’ve encountered magic methods — you can tell it is a magic method because the method is preceded by two underscores. If you’re not using these tools, you should be. Magic methods are functions that allow you to show an object how to react when something happens to it. You get to define how your object should react in an event. This can be a huge tool in preventing errors and reducing redundant code. In this article, I am going to introduce you to some of the magic methods that PHP provides. […]
Should User Data From WordPress.org Belong To The Community?
I don’t have a problem with paying for services with data. I use Gmail, knowing full well there is no way Google would provide me with such an amazing service if they didn’t use my data to create targeted ads. Similiarly, I use Facebook, Twitter, and other “free” services knowing that I am the product that these services offer to their customers. This is how I “pay” for these services. If they can’t sell ads, then they can’t make money and that, after all, is their objective. Two WordPress plugins I use a lot, WordPress SEO by Yoast and Easy […]
Concentrate On Your Product And Your Users With Freemius
I think it’s important for WordPress companies to seek advice from those outside of the WordPress economy. While WordPress users have experience in the subject matter, an outsider’s perspective brings fresh insight. It’s one of the many reasons I participate in my local startup culture in Tallahassee. With the exception of hosting, it’s often challenging to explain your WordPress product business. This is in part because people might not see WordPress.org as an avenue to sales since it is not a marketplace. WordPress.org, however, is a great user-acquisition and delivery channel for freemium plugins and themes. Free plugin and add-ons or limited […]
Learning JavaScript At WordCamp Miami
Last month, WordCamp Miami featured a track completed dedicated to learning JavaScript. This full-day track covered everything JavaScript — from the fundamentals to more in-depth talks on frameworks — and was inspired by Matt Mullenweg’s 2015 State of the Word homework assignment to “learn JavaScript, deeply.” I presented on AngularJS basics and how to use Angular with the WordPress REST API. As someone who has wanted to see WordPress move towards more dynamic interfaces for a long time now, seeing this interest in API-driven JavaScript interfaces is very exciting. In the past, JavaScript has been more of an afterthought, mainly using […]
Josh Pollock’s Takeaways From ManageWP’s AMA With Josh Pollock
Earlier this month ManageWP invited me to do an AMA with the community. It was an interesting experience. Emily Schiola did her traditional round up on the top takeaways, but I wanted to take this opportunity to elaborate on some of the answers I gave during the AMA. To be honest, I was worried that I wouldn’t get a lot of questions. I already share a lot about myself, my story, and my process on social media, through blogging, and by appearing on many WordPress podcasts. To my surprise, however, I received a lot of questions and I had a really great […]
Making The Most Of AMP For WordPress
Before responsive web design and the ubiquity of high-speed mobile Internet, most websites built a special, mobile version of their site. A mobile version that stripped away most of the site’s fancy CSS and other functionality to provide a faster version. At the time, this was a necessary evil as a desktop site was never going to load or display properly on a tiny screen with a slow Internet connection. With the introduction of a fast Internet connection for mobile devices, responsive web design allowed websites to create one design that could work on any device. But, as websites have […]
Connecting An Angular App To The WordPress REST API
In a recent Torque article, I gave a basic introduction to AngularJS using the WordPress REST API. I also had the privilege of presenting on this topic at WordCamp Miami and will be covering AngularJS with WordPress at an upcoming webinar for WP Engine. This topic is important to me because I think that embracing API-driven JavaScript interfaces will help us bring the experience of WordPress forward and ensure that WordPress continues to be known for the quality of its interface. My personal choice in a JavaScript MVC framework is Angular. You may prefer a different one, but for my work, […]
3 Comments