I previously wrote a post about running WordPress on AWS Lambda, but it was before EFS support was announced (EFS is a managed network file system AWS provides). Being able to use EFS completely changes the way WordPress works in Lambda (for the better!), so I felt it warranted a new blog post.
In addition, this time I’m using Terraform instead of SAM. This matches the existing infrastructure-as-code setup I use when I deploy infrastructure for clients. Here’s the Terraform module ( source code).
One of the things that I’ve built regularly are custom WordPress themes for clients. Let me clarify – a custom theme for each client. One theme per client.
So, I decided to try my hand at making a “proper” WordPress theme – a theme for regular users. And I submitted it to the WordPress themes gallery. Successfully!
[caption id=“attachment_304” align=“aligncenter” width=“640”] wp386 - my first public WordPress theme![/caption]
Situation: You’re migrating a big site to WordPress. You don’t want to make 1,000+ posts manually, do you?
Meet Ruby/WordPress. I’ve made a quick little Ruby gem that interfaces with your WordPress database, so you can manipulate it within Ruby. This opens up a whole world of possibilites - the most exciting being Nokogiri, of course.
Here’s a quick code sample that will create 100 new posts!
require 'wordpress'# Configurationwp =WordPress.new { host: '127.0.0.1',
port: 3306,
username: 'test',
password: 'test',
encoding: 'utf8',
database: 'wordpress',
wordpress_prefix: 'wp_' }
(1..100).each do|i| post = wp.new_post { post_name: "post-#{i}",
post_status: 'publish',
post_title: "Post #{i}" }
post.post_content ="This is the content for post #{i}" post.save!
end
Note that the configuration must point to a valid WordPress database (and make sure you don’t use one with valuable data… I don’t take responsibility for any lost data. You should be backing up anyways.)