Namespaces aren’t used by WordPress programmers, but I’ve been using them, and like them. This short tutorial explains namespaces, and how they work together with class autoloaders to keep your code organized.
Continue reading PHP Namespaces, Autoloaders and WordPress
I ran some updates, and the name service stopped resolving. My LAN has a local nameserver to resolve domain names for virtual machines.
It turns out the /etc/resolv.conf file was overwritten, and a program called resolvconf had taken it over. resolvconf centralizes updating the resolv.conf file from several different programs that might want to change the file, like NetworkManager, ifup, ifdown, and dhclient.
There are a couple fixes. The one I chose was to replace resolv.conf.
Continue reading /etc/resolv.conf, resolvconf, NetworkManager (and systemd-resolved?) Not Working
On the page where they explain how to create tables for your plugin, there’s a link to the register_activation_hook function, which is run when the plugin is activated. However, right in the first section, it says:
Note: Don’t use activation hooks (especially for multisite). Do this instead:
It’s far better to use an upgrade routine fired on admin_init, and handle that per-site, basing it on a stored option.
That links to another page, which repeats the information, but doesn’t tell you how to do this. Here’s one way. Continue reading WordPress Plugin Update and Install Functions
Everyone loves the parallax effect, and I’ve been swiping snippets of code to do it for a long time, but never really thinking about it too much. You load it, set some parameters, and that’s it. I was having a little glitch with one, and was tweaking it, and I started to wonder why the effect didn’t just start at one end of my image, and end at the other end.
After all, if I don’t show all the pixels, I’ve “wasted” all those network bytes to load the data, and all the memory to hold the data.
This parallax effect is stingy with network bytes.
Continue reading Yet Another Parallax Effect, but This One Wastes Fewer Pixels and Bytes.
I’m shocked at how many businesses still have websites that don’t work in mobile. For the average person, reading web pages on a smartphone is the primary way they read content on the web.
Though I’m not 100% on board with “mobile first”, it should soon be the norm. To CSS hackers, “mobile first” just means implementing the mobile layout first, then making the wider-screen layout the exception.
Continue reading Responsive Design + Mobile First = Automated Layouts
I’ve been doing a lot of WP hacking, but my website was on a very old copy of Drupal (version 6!) so I thought it best to transition to using WP for my personal blog.
The old site is here.
They’re both good platforms, but the WP market just seems to be dominating, especially for lower-cost sites.
WP’s core code is still a maze.
Every time I get a grip on one part of the codebase, I go into another part, and it’s completely different. The code quality has improved, though, so, it’s pleasant.