Home » plugins

Tag: plugins

CakePHP and WordPress

I’m not too fond of WordPress and yet…

Most of the websites I have built are using WordPress.

The reason I am using it is simple: The final customer enjoys the ease of use that WordPress provides. It empowers them to maintain the content of the website and (to an extent) manage the website themselves.

WordPress is excellent for what it was built for: a blogging platform. As soon as you begin to “add on” to it and make it into a complex web-application, things break down in terms of performance, stability, and security. It pains me to see how every plugin is downloading its own set of libraries and code, creating an app, with-in an app, with-in an app.

This problem shows up because each plugin developer has to make sure that all the code they need is there, and they don’t know if you have it from other plugins. So the code base gets fatter and fatter with duplicate code, and the website gets slower and slower.

Maybe in the future, the core of WordPress will be re-written from scratch to address these issues and to have a shared library folder or use some dependency manager (like composer).

In contrast, for the more complex web applications, I have been using CakePHP. The reason: I love Cake, and I like PHP!

Joking aside, CakePHP is a framework that allows rapid application development using modern design and technologies. Because it is a framework and not a full app (like WordPress), there is much flexibility on how you want to do things, what libraries you want to use, how do you want to integrate it with the rest of the world, and so on. This approach makes for much cleaner logic and code and better performance.

The downside is two-fold:

First, the customer needs a tech person to maintain a CakePHP app. There are no simple “update everything” buttons.

Second, for better or worse, you lose the considerable plugin ecosystem that WordPress has to offer. And some plugins are super useful, like Yoast SEO.

The Best of Both Worlds

(no, this is not about the Star Trek episode)

What I have ended up doing in some cases is to have a CakePHP app developed alongside the WordPress app for the clients that agree to have me as their tech person. This setup allows them to use WordPress for more frequent and simple tasks and enables me to deploy the power of CakePHP to manage automation, monitoring, and reporting for their business. Win-win!

Case Study

For a big WordPress site where things needed not to break down, and that specific metrics are met every month, I have developed a custom CakePHP app to monitor the WordPress site. It would generate charts and analytics for sales, visits, engagement, and other metrics. It would issue alerts when needed and generate reports daily, and monthly that would make it easier to diagnose any potential problems.

Yes, everything could have been written in WordPress as a plugin, but that would have meant making a fat code base even fatter, and it would have linked the two very tightly. Having a separate application allows me to update them separately, and if one stops working, it does not upset the other. A side benefit that I got, later on, was that the same app could link into other WordPress (or Joomla!) powered website for aggregate data reporting.

If you have the skill or the resources to hire the skill, it may be worth considering creating your custom development in CakePHP instead of WordPress.

If you’re interested in the technical details, leave a comment, so I know to write about it.

Keep your site up to date – good advice, but only in theory?

“Keep your software up to date!”

I am sure you have heard this saying many times, and in general, it is good advice.

However, let’s take a WordPress website, for example.

A WordPress site is made from the WordPress core and usually many plugins. You have many pieces in your puzzle. Not all of them are updated at the same time or in the same way.

In my experience, it happened more than once that an updated piece no longer fit with the rest of the puzzle. Auch!

Most update processes do a good job warning you that you need to do a backup first and to ensure the other plugins (components of the puzzle) are compatible with the update.

This approach puts the responsibility of “making sure that things still work” with the user. And not everyone can make that assessment. Also, let’s admit it, sometimes we are in a hurry or just plain lazy :). Ideally, a piece of software should not rely on a human to do the right thing.

I too used to be overconfident in the automatic updates process, and I would apply those every time there was a new update. Click, click, and I was done! What could possibly go wrong?

One time, I updated the store. We had a newsletter scheduled that we expected to generate much interest and I thought I wanted to offer the best and latest shopping experience for our customers. So I updated the store and was on my way. The next day I opened the email to a ton of complaints from our subscribers that the checkout is not working! A full email campaign wasted, not the mention that we looked totally unprofessional — that hurt both my ego and the sales.

What did I learn from it?

1. Updates can potentially be very painful

2. You never change the system right before a big promo campaign. (This feels like common sense now.)

3. You need to be extra careful when you update the part that generates income: the store, the “pay now buttons,” and the subscribe boxes.

4. After you update you need to test at least the critical functionality: add to cart, checkout, subscribe.

5. You better have good backups, in case you need to roll back.

It was not all bad, because I did have backups, so it was relatively easy to go back to the previous version. Moreover, I sent another email campaign with an apology and a second invitation to check out the offer. If I hadn’t had backups that would not have been possible to do.

Another thing I decided to implement is to write automatic tests for the website that can run in the background and make sure the critical processes are still working.

In conclusion: stay up to date, but be smart about it 🙂