Category: Web Development

Filed under: Blog, Web Development

How I Wrote My First Bash Script to Implement WP-CLI on Managed Sites

They say if you want to learn something, teach.

Or scratch your own itch.

Or just do it.

In any case, I had an itch that I have been wanting to find a fix for for a while.

If you are a developer like me, you began figuring this “WordPress thing” out through tutorials, trial and (mostly) error, and trying a lot of different things out.

Also, if you’re like me, you got into this for several reasons, one of which is the joy of helping people out and getting them a website setup and launched. I love the satisfaction of getting that project launched and the joy these folks have when they realize they can manage their own publishing.

And of course, if you’re a developer like me, you have a shared hosting account with at least a dozen different websites that are small personal projects or folks on the “friends and family plan” (read “free hosting” 🙂 ). This means I have a dozen or so sites I want to make sure I keep updated, but don’t want to spend a lot of time updating.

So, I decided to learn enough bash to write a script that would execute WP-CLI commands on my local environment as well as my shared hosting.

Here’s how I did it…

Continue reading

Filed under: Web Development, What I Learned

My First Open Source Code Contribution

A lot of developers have stickers on their computers. Sometimes the stickers are like pieces of flare. Sometimes, they’re like merit badges. Still, other times the stickers are like a signal flare. Whatever the case, I geek out about them a bit. I see the stickers somewhere in between a merit badge, a piece of flare, and that signal flare.
I have one sticker on my laptop:

Continue reading

Filed under: Blog, Web Development, What I Learned

Getting Post Meta for the WP REST API

My friend and I are working on a little side project. It’s a job posting site for an industry we’re familiar with: ESL jobs around the world. While this project could be seen as “just another job board”, we’re hoping to add some features that will make it fun to use and valuable for schools and recruiters. I of course want to build it on WordPress, but to get a some of the functionality I want, I need to expose some post meta to the WP REST API.

In researching how to do this, I quickly found out that the WP REST API doesn’t naturally expose post or user meta. As with most things WP REST API, you don’t have to go too far down the rabbit hole before you find a practical article written by the Josh Pollock. While the register_api_field function isn’t in use anymore, the register_rest_field function is, so this article and that function were all I needed to get going.

Continue reading

Filed under: Angular, Blog, Web Development

Genesis and Angular: Adding Routing to Posts and Pages (Part 3)

This is the third post in a three part series on using Genesis and Angular. Part 1 can be read here, and Part 2 can be read here. 

Routing is part of the magic of web applications, and not something that we really think about when we’re developing WordPress sites since it’s basically taken care of for us in using the nav menu and full on links with page reloading. But this project was all about skipping the page load, and having a view area that will dynamically load posts and pages, an “app-like state” some might say.

Using Genesis and Angular to display posts and pages in an app-like state wasn’t super straightforward. While it opened a few extra cans of worms I wasn’t expecting, adding routing for both posts and pages has proven to be super interesting, and got me digging into WP core as well to find some answers.

Let’s review the goals of this project:

Primary objective: Create a view area that will display all the contents of posts and pages without a page reload using Genesis and Angular.

Do this by:

  1. Adding markup to my Genesis child theme
  2. Fetching data with the WP REST API and Angular
  3. Routing the data Angular on posts and pages

Ok, this is going to be a bit of a beast, so let’s get truckin’…

Continue reading