Software Engineering in WordPress, PHP, and Backend Development

Author: Tom (Page 371 of 424)

Simple Country, State, and City CSV’s for Download

If you're only interested in the files and without implementation details, then you can grab them.

Every now and then, I end up working on a project that requires a form that includes county, city, and state information. More often than not, the client doesn’t about the rich data associated with any of the above – that is, they’re not particularly interested in latitude, longitude, population, or even zip code.

Simply put, they want the user to be able to select their country, select their city, and then select their state from a predefined list of options.

For the past couple of projects, I’ve been using three, very simple CSV’s for this and thought I’d share them here should anyone else want to use them. Additionally, I thought I’d share a simple implementation of how they can be used in WordPress projects.

Continue reading

What Constitutes Clean Code in WordPress?

When it comes to writing code specifically for WordPress, I try my best to follow a combination of the WordPress coding standards, tips and advice from various books I’ve read (which I hope to cover in a future post), tips from others in the community, and certain habits that I’ve developed along way the way.

The thing that I’ve always struggled with determining is what constitutes clean code. There is code that follows standards, then there’s clean code, and I think that the definition is almost somewhat subjective.

With the open source nature of WordPress, the desire to improve education around the platform, the desire to improve the plugins repository, and the existence of things such as Theme Review team, Theme Unit Test, and tools specifically for helping us write code, there’s an innate desire for programmers to write clean code – I just think that we could do a better job defining it.

To be clear, I don’t believe that clean code is synonymous with quality code, nor do I believe that clean code is synonymous with good code. They’re absolutely all related, but they aren’t the same thing.

With said, what does constitute clean code specifically in the context of WordPress development?

Continue reading

http://www.youtube.com/watch?v=taQOIbG875g&feature=youtu.be

I usually don’t share videos, links, or other things like that unless I find them extremely useful or very funny. Earlier this week, @dewde shared this video with me – it’s a talk by Gary Bernhardt entitled “Wat.”

For those of you who have done any programming with dynamic languages, especially Ruby or JavaScript (and PHP developers will likely have hit similar snags), you’ll likely find yourself laughing out loud.

Continue reading

Redactor Image Uploads For WordPress

For the past few weeks, I’ve been working on a web application that’s being built on top of WordPress.

One of the requirements dictated the users should be able to have rich editing from the front end after being logged in. This includes being able to do the usual bold, italic, strikes, and link, as well as images and videos.

Redactor.js is a fantastic jQuery plugin that brings front-end editing to any website or web application, but implementing Redactor JS image upload and WordPress proved to be a bit of a challenge specifically because I wanted to keep all images organized in the standard wp-content/uploads directory.

So, while working on said project, I also generalized the script a bit and created Redactor Image Upload For WordPress.

It’s a short, simple title, right? Right-ish.

Continue reading

Programmatically Resize Images in WordPress

If you're experienced with programmatically uploading files, you may wish to skip down to the code.

I’m finishing up an application that’s built on WordPress that has required that I programmatically resize images. When it comes to building themes or plugins, it’s relatively easy to specify add_image_size and then let the user interface and core application do it’s thing.

But in my case, the end user will have no idea that the actual application is built on WordPress and the image resizing function needed to be a little more tailored for specific templates (or views)

So rather than use the typical WordPress facilities for uploading and resizing images, here’s how to programmatically resize images in WordPress.

Continue reading

« Older posts Newer posts »

© 2024 Tom McFarlin

Theme by Anders NorenUp ↑