WordPress Loop Error Using get_the_terms

If you get this WordPress Loop Error… “Warning: Invalid argument supplied for foreach() in [filepath].php on line [number]” when you try to loop over terms found using the WordPress function get_the_terms, you may find this information useful. It happens when you have a post that hasn’t been linked to any terms… but it caused byContinue reading “WordPress Loop Error Using get_the_terms”

WordPress Custom Query Page Size

WordPress normally takes care of queries for you. When it doesn’t, your next port of call is normally WP_Query. After that, you head into nuts-and-bolts mode with a completely custom query using get_posts. When you start taking control over queries, you may hit this common problem with page size. Here is an example of customContinue reading “WordPress Custom Query Page Size”

Signs You Broke the Interface Segregation Principle

I have written quite a lot about how to follow SOLID principles, but one thing that can be useful is examples of where a principle is not being followed. What does your code look like when it wants to tell you something? Here are the signs that you broke the Interface Segregation Principle (ISP). HereContinue reading “Signs You Broke the Interface Segregation Principle”

Your Identity Should Be Immutable and Unconfusable

There are lots of ways to make an identity immutable and unconfusable. I’ll show just a couple, but first the principle behind it. Your identity should be immutable, because you will accumulate lots of threads back to your item that need that identity. If the identity changes, you will be breaking all of the relationshipsContinue reading “Your Identity Should Be Immutable and Unconfusable”

WordPress Social Sharing Links Without JavaScript

If you, like me, find yourself staring at the network traffic spewing out of your website you will have noticed the JavaScript problem. No matter what plugin you use, it seems to require three or four JavaScript files. Want to show a picture of a cat on your website? You’ll need jQuery, React, and Meteor.Continue reading “WordPress Social Sharing Links Without JavaScript”

Writing a Mobile App Using HTML 5

Everyone is keen on writing apps these days. For an organisation, apps are the buzz. For consumers, apps are the convenience. The only problem is that writing apps that target every operating system (and then every version of an operating system that has a wide distribution between versions) can be quite a task. This isContinue reading “Writing a Mobile App Using HTML 5”