Step 1: Understand the Problem
Talk about what the site is, what it will do, what it will need.
Step 2: Brainstorm solutions
Think about how to best approach the problem. I was put in charge of the map only, not the rest of the site. So, I couldn’t build the map data functionality into the site theme (especially since it was using a theme builder – not ideal). So, I decided to make a plugin that would handle the data. The actual map would be built within the theme.
Step 3: Build the plugin
This took a while. It was my first plugin, and a bit of a complicated one at that. It uses the WordPress HTTP API to send, update, and delete data from a Mapbox dataset. It allows for 3 custom fields and sending categories and tags as well as general post information, like the GUID. I have a lot more ideas for plugin features, but those weren’t necessary for this project.
Step 4: Build the map
This was a bit more difficult than the plugin, unexpectedly, because the Mapbox Datasets API is well-written and easy to use; the Mapbox GL JS documentation is poorly written and very difficult to use and understand. Their examples are mildly helpful if your use case exactly matches their example. Otherwise, it kind of sucks.
This had four parts: display the map with the points, color the points by historical segment, filter the points by year, and filter the points by category.
Step 5: Upload the real deal data
Working on this one.
There are two reasons you may want to add custom cron jobs for your WordPress website:
- Your site is low-traffic and you want cron jobs to run regardless of whether or not someone visits the site
- Your site is high-traffic and checking if a cron job needs to be run every time someone visits the site is a burden on your server
Adding a custom cron job for WordPress in your Dreamhost account is easy. First, you disable the default WP Cron in your config.php file. Next, you add the cron job to your Dreamhost account. Let’s get started!
How to Disable the Default WP Cron
Open up your site’s
config.php file. This is in the root of your WordPress installation. You’ll need to have access to your site’s files directly (eg. with FTP) as this isn’t something that can be edited from within the WordPress dashboard.
Scroll down to the bottom. Right before you see the line that says
/* That's all, stop editing! Happy blogging. */, add the following code:
/* Turn off default WP Cron */
Save the file.
How to Add a Manual Cron Job in Dreamhost
Log in to your Dreamhost dashboard. Navigate to Goodies -> Cron Jobs in the left-hand navigation.
Select “Add a New Cron Job.”
Select the user associated with your website and give the cron job a title – “WordPress Cron Jobs” usually does the trick. Enter an email address you want the cron output sent to. This isn’t necessary, but is nice to have until you know everything is running properly.
In the “Command to Run” box, enter the following, using your domain name instead of example.com:
Select an interval for when to run. Hourly is common, daily works also. Keep in mind that until you turn the email off, you’ll get an email every time the cron job is run.
Click the blue “Add” button at the bottom to save the new cron job. And you’re done!