Recently I’ve been experimenting with running WordPress strictly as an API. Decoupling WordPress from the functionality and layout of the site really opens up the possibilities for what you can build and what tools you can use. In my opinion, developing WordPress templates can be kind of messy with PHP and HTML mixed together and a general lack of structure. For my purposes, I want to explore other development methods while keeping the strong CMS experience that WordPress offers.
While you can configure WordPress to work as an API by developing your own custom endpoints without too much trouble, there is a basic system built in to WordPress already. You can use the WP REST API project as a plugin to further expand the APIs capabilities. There are also several other plugins out there that hook into the API structure to make really anything possible, without ever having to define your own endpoints.
For the front-end of my experimentation, I decided to just use jQuery to hook into the WordPress endpoints and parse through the JSON. I’m also trying out a very minimalistic JS router called PageJS as an easy way to access endpoints. Two other paths I will try out out are a React front-end with a JS router, and Rails.
There are some really great applications for using WordPress in this fashion. For instance, if a site has an accompanying app, the WordPress API could greatly help centralize content for both properties. Another huge benefit for me is the simple fact that I can develop in pretty much whatever I want, avoiding some of the less desirable aspects of WordPress development.
In general, I think the web development industry is moving towards a stronger focus on RESTful architectures and MVC frameworks, and the WP REST API is a part of that.
This past week I’ve been doing some research to consult on a new prospective web project. The organization is looking to build a WordPress plugin for a form. The form would need to take location data from a visitor, and then match them up with their U.S. Senate representative. The point of the form is to send an email to the rep. from the visitor with a message regarding the organization’s cause.
At first I thought this seemed fairly straightforward. All I need is a database of Senate members’ locations and email addresses. I found the location data I needed within minutes of searching, but ran in to some roadblocks trying to find email addresses of any kind for any representatives. It turns out that no U.S. reps ever publish their email addresses anywhere. The only way to get a hold of a rep through email is to find and fill out overly complex forms on their individual (slow) websites. This method makes it impossible for online organizations like this one to rally support for their causes.
Fortunately, I am not the only one to run into this problem. There is an ambitious project by the EFF, Sunlight Foundation, and Taskforce.is to create a huge YAML database of reverse-engineered contact forms for every single U.S. representative. The Contact-Congress project is entirely open-source on GitHub, depending on hundreds of contributors to collect the massive amount of data needed. The data is already being used by incredible projects like emailcongress.us and democracy.io.
While it’s certainly possible to build out this plugin, having to implement this massive YAML database into WordPress will most likely put the project out of scope for this organization. But I’m still glad I looked into it and found out about the Contact-Congress project. I think it’s a great testament to the benefits of open-source, and the amazing sharing and collaboration that happens in the development community.
The Web in Developing Nations
So it’s been way too long since I last wrote here. My writing efforts have been entirely focused on my master’s degree in Human-Computer Interaction, so I thought I could at least post some of that work here for the time being.
I recently wrote a research paper about web usability in developing nations. I love discussions around web performance, so I was particularly interested in this topic. In the context of the class, I wasn’t able to dive as deep into the technical aspects as I would have liked, but I’m pretty happy with out it turned out overall. Here is a quick intro to the paper:
The internet is widely available and reliable for those of us in developed countries like the United States and most of the European Union. We have fast, highly accessible networks, ever more powerful technology to access these networks, and relatively good education systems to help us use them. But people in less developed areas of the world can have a significantly different, and often more challenging experience accessing the web. What are the problems people in these developing countries face in regards to web accessibility and usability? How can a better interaction with the web help improve the lives of these people? As designers, developers, and analysts, what can we do to improve this interaction, and why do we even care in the first place?
You can read the full paper here.
It’s been awhile since I’ve had the time to write because of the holidays and diving further into my HCI master’s program at DePaul. I finally took some time to reflect on my work from the past few months, so I’d like to write about a couple of projects and some insights I’ve gained from them.
The organization I work for now is going through a major overhaul on its eCommerce platform. We are moving inventory to a new warehouse, changing shipping policies, adding new products, and working towards simplifying our customers’ experience. My role so far has been to rework our SQL databases to conform to our new data structures, rewrite the back-end (PHP) logic associated with those tables, and rework our store website’s custom admin panel. It’s been a lot of work, but I’ve really enjoyed the chance to stretch out my SQL knowledge.
Data structures seem to be a common thread between my work projects lately. My work involves different ways of organizing data, like JSON, SQL, and associative arrays, and how to communicate that data around different programming frameworks. It’s always satisfying when all the different parts of a system fit together nicely and churn out exactly what you expect.
Future of WordPress – Calypso
If you’re tuned in to the world of web development, you may have seen some exciting headlines about WordPress recently. WordPress is being completely rewritten in React! WordPress is now built on Node! WordPress is abandoning PHP for newer technologies! While statements like these make for clickable headlines and thrilling tweets, I don’t think they accurately describe what’s actually happening on the web’s largest CMS.
I’m still not really clear on how this affects the rest of the WordPress backend. Some tech sites and documentation indicate that WordPress is actually moving away from PHP and SQL databases entirely, in favor of Node and JSON. Other articles I’ve read say that Calypso will only affect the view model of the WordPress admin, and the rest of the backend will still be PHP as it has always been.