Skip to content

Wordpress

New theme with a somewhat updated look

My blog's general appearance dates back to 2014, with a face lift in 2017. But the site was still using a (very!) old theme as its base, and that old code was throwing a ton of errors into the logs (mainly warnings). I felt it was time to find a new base to build from, so the site is now using a modified version of the Neve theme.

Things hopefully look mostly the same, though there will be some minor changes made going forward as I discover things that aren't working as they should, and clean up some loose ends—and probably change my mind on fonts a dozen more times. Please let me know if you run into any issues with formatting or functionality on any of the pages.

Update: Thanks to some great help from Many Tricks' founder and resident CSS expert Peter, the theme should now look fine on all devices—and he cleared up many other minor issues I was having. Thanks, Peter!



Keep authenticated WordPress sites up to date

I have a couple of WordPress sites that live behind HTTP basic authentication—they're family-related blogs that I don't want publicly accessible.

Everything works fine behind the authentication except for automatic updates (and other WordPress cron tasks). This bugged me a bit, but never enough to do anything about it until today. To fix the problem, you can either modify some code (which I generally don't like to do) or use a plug-in (easy and quick). I chose the plug-in.

If you'd prefer the customization solution, though, just follow these instructions. I haven't tested them myself, though, so I can't say for sure that they still work (they are five years old).

For the plug-in solution, install WP Cron HTTP Auth. Go to its Settings panel, and enter your HTTP Authentication credentials, and that's that—WordPress cron tasks, including automatic updates, will now work again. Hooray!



Use SQL to show MySQL tables in decreasing size order

Earlier today, I noticed that the robservatory database was massive—over 1GB in size, which it shouldn't be anywhere near (it's usually around 100MB). This is over the database size limit at my host, so I couldn't add any new content (nor could visitors comment, create accounts, etc.)

My host offers phpmyadmin acccess, so I connected to the database to try to figure out what was going on. Using phpmyadmin, you can browse tables, perform SQL commands, and export and import data—it's a must-have tool for managing remote databases.

The first challenge was to figure out which table was causing the problem. To help with that, I wanted to see which WordPress tables were the largest, as that should be a good hint. A web search found lots of possible solutions, but I liked this one the best. Within that thread, I slightly modified one of the queries to do what I wanted:

[continue reading…]



Back to posting…after fixing a snafu

I actually intended to start posting again a few days ago, but I was running into a couple of issues with the site: It was incredibly slow (annoying, but survivable), and the editor box was missing when I added a new post (which made posting quite tricky). I tried the usual troubleshooting steps—made sure everything was updated, disabled plug-ins, even briefly changed the site's theme to see if it was a theme issue. No luck with anything.

Then I enabled WP_DEBUG on the site, which is something you should never do on a live site, as it will fill every page with tons of mostly meaningless warning and error messages. But in my case, I had to see what was happening when I tried to load the new post page. What I saw was troubling…

WordPress database error: [INSERT command denied to user '#######'@'###.###.###.###' for table 'wp_options']
INSERT INTO wp_options (option_name, option_value, autoload) VALUES ('_transient_timeout_jetpack_sync_constants_await', '1502403204', 'no') ON DUPLICATE KEY UPDATE option_name = VALUES(option_name), option_value = VALUES(option_value), autoload = VALUES(autoload)

WordPress database error: [INSERT command denied to user '#######'@'###.###.###.###' for table 'wp_options']
INSERT INTO wp_options (option_name, option_value, autoload) VALUES ('_transient_jetpack_sync_constants_await', '1502399604.7325', 'no') ON DUPLICATE KEY UPDATE option_name = VALUES(option_name), option_value = VALUES(option_value), autoload = VALUES(autoload)
...
...

This went on and on, with screenfuls of such errors. Uh oh. Web searches found lots of possible causes with fixes, but none that worked for me. So I logged into 1and1 to check on the database…and I didn't have to get any further than the summary screen to see the problem, as revealed in the image at right: The site's database was using 150MB of the 100MB allocated to it—whoops!

100MB is not a lot of space, and it's not what I get when I create a new database on 1and1—the limit is now 1GB. So why so puny? Basically because I've had robservatory.com since 2005, and never ever updated the database! I have no idea how long it's been over the limit, but apparently it was finally over the limit enough that no more data could be written to the database.

The problem is that 1and1 can't just bump the size of the database; you have to create a new one and migrate your data over to it. Thankfully, that's not overly hard (read the rest if you'd like to know how I did it; documented for my own future sanity). After I moved to the new database, my edit window was back (hooray!), and as an added benefit, the site got much faster: The database is now hosted on an SSD, and the site's not throwing 5,000 errors per second any more.

And now, I can get back to real blog posts.

[continue reading…]



Control animated GIF playback on WordPress sites

I wanted to embed an animated GIF in my post about changing the iOS Settings screen. However, because the GIF was about 4MB in size, I didn't want it to auto-load—and in general, I find auto-playing GIFs annoying. I wanted something that would stop and start on click, like this (wonderfully subtle) example GIF

So I did what any WordPress user would do in such a situation: I went looking for a WordPress plug-in that offered control over GIFs.

I initially found WP GIF Player and GIF Animation Preview. Both did what I wanted, mostly, but they added a bunch of their own HTML and CSS, and/or relied on the WordPress media library (which I don't use). After testing both, I just couldn't get them to work with the GIF and the size/position that I wanted to use. Perhaps there are others that would work, but I got frustrated and gave up searching.

[continue reading…]



Like a kid in a candy store…

Back in January, I spent a morning at the Portland International Auto Show, walking around looking at a huge assortment of new cars and trucks, and even a couple of campers.

As the title says, for me, short of actually buying a new car, that was peak fun. I love everything about cars, and walking around a car show is about as good as it gets: All the new cars, none of the sales pressure of a dealer visit! Here are some of the better shots from the morning's virtual shopping trip. [View on Flickr]

  • Dodge Challenger
  • Alfa Romeo 4C Coupe
  • Alfa Romeo 4C Coupe
  • Fiat 124 Sypder (Miata based)
  • Acura NSX
  • Acura NSX
  • Acura NSX
  • Ford Mustang
  • Ford Mustang
  • Infiniti Q60 Coupe
  • Chevrolet Corvette
  • Chevrolet Bolt
  • Chevrolet Bolt
  • Chevrolet Bolt
  • Chevrolet Camaro
  • Subaru WRX STi
  • Ferrari something…
  • Ferrari something…
  • Ferrari something…
  • Ferrari something…
  • Ferrari something…
  • Ferrari something…
  • McClaren 570S
  • Lamborghini Huracán
  • Mercedes Benz S65 AMG
  • Mercedes Benz S65 AMG
  • Nissan GT-R
  • Nissan GT-R
  • Mercedes something…
  • Mercedes something…
  • Mercedes something…
  • BMW i8
  • BMW i8
  • BMW something…
  • BMW M6
  • Audi RS7
  • Audi R8 V10
  • Audi R8 V10
  • Audi R8 V10
  • Porsche 911 Carrera
  • Porsche Panamera
  • Bentley Continental
  • Bentley something…
  • Lamborghini Huracán
  • Lamborghini Huracán
  • Rolls Royce Dawn

Of the vehicles we saw, the Acura NSX and the BMW i8 were both very striking looking—much more so in person than in photographs. And I think the Audi RS7, especially in all-black, is one of the meanest-looking cars to come along in a long time. Now I just need to come up with the $7.5 million or so it'd take to buy all the cars on my wish list!

The above album is hosted on Flickr and displayed here via a plug-in; read on if you're interested in how I did that…

[continue reading…]



Easily copy or move a WordPress blog

I was looking for an easy way to make a development copy of the Many Tricks blog, which (like Robservatory) is powered by WordPress. In the past, I've done this manually, but it's a bit of a pain to get the required edits done correctly and make everything work at the new URL.

So this time, I went searching for a plug-in, and found Duplicator. Borrowing from the plug-in's description of itself…

Duplicator gives WordPress administrators the ability to migrate, copy or clone a site from one location to another. The plugin also serves as a simple backup utility. Duplicator supports both serialized and base64 serialized string replacement. If you need to move WordPress or backup WordPress this plugin can help simplify the process.

Once installed, usage is pretty easy: You follow a simple three-step process that creates a new package. Move that package to the new location, expand it, and then run the installer.php file. (I had to rename the three files from the package to remove everything except the filenames; the plug-in adds a bunch of identifying text in front of each filename.)

The installer asks questions about the new site's URLs and database connection info, then does its magic. I had a clone site up and running in minutes, saving what (for me) is usually an hour or so's aggravation. Duplicator should work equally well for moving a WordPress installation to a new host, too, though I haven't tested it in that situation (yet).



Center embedded tweets on WordPress sites

WordPress has a neat built-in feature that, when composing a post, if you put the URL to a specific tweet on its own line, like this…

https://twitter.com/rgriff/status/827901296258584576

…then WordPress will automatically convert it to a tweet link, like this:

By default, though, the embedded tweets will be left-aligned. I wanted them center aligned, as above. And because I just wasted 15 minutes figuring this out, I'm documenting the solution here to save myself future aggravations…

[continue reading…]



Add Drafts to WordPress admin sidebar

One of the things that annoys me about WordPress' admin side is that to get to draft versions of posts, you have to first select Posts > All Posts, wait for that page to load, then select Drafts. The majority of the time, when I'm headed to my posts, I'm headed to the drafts section to work on an upcoming post.

This little modification adds a Drafts entry to the Posts sidebar item, as seen in this before-and-after view:

The change is relatively trivial, requiring only a simple edit to your theme's functions.php file. David Walsh explains it all in this thorough post. I've recreated the bit of code in the remainder of this post, just in case the linked site ever goes away. (It's all under the MIT License, so there are no restrictions on copying.)

But really, just go read David's post, he explains it very well. I've added this to the admin page on the three sites I run, because it's just so convenient.

[continue reading…]



WordPress plug-ins, take four

This is the fourth (one, two, three) in an occasional series of articles that explain which plug-ins I use here, in case others who run WordPress blogs might be interested…and it also helps me document why I use certain plug-ins, so it's a double-purpose post.

Since the last installment two years ago, I've retired Dashboard Commander and ELI's Related Posts Footer Links and Widget, and added seven new plug-ins. Here's what each of those does:

[continue reading…]