Software Engineering in WordPress, PHP, and Backend Development

Category: Articles (Page 155 of 258)

Personal opinions and how-to’s that I’ve written both here and as contributions to other blogs.

Google Maps in WordPress: Adding a Marker

In the previous post, we added our first map to the template that we’ve been working on throughout this series.

Through a third-party tool, we ended up getting the latitude and longitude of a city in order to center the map, and though we still have refactoring that we’ll need to do, we successfully displayed the map on the screen.

But part of the lure of using Google Maps is the feature that it offers as it relates to marking certain locations. That is, displaying one of those little red pins that Google Maps shows when you’re browsing for a location, a destination, and so on.

So starting in this article, I’m going to walk through the process of adding up to two markers.

Over the next few articles, I’ll cover how to add multiple markers, and how to do so in a way that’s efficient when it comes to loading up the map on subsequent requests so you’re not exhausting you’re API calls every single time you need to render the map.

Continue reading

Displaying Google Maps in WordPress

If you’ve been following along with this particular series, then you’ve got a template setup and ready to begin displaying Google Maps in WordPress.

For whatever reason, if you’ve just stumbled across this series, then I’ve shared a basic introduction of the topic as well as how to setup a template within Twentyfifteen in WordPress 4.2.2 or how to display a map.

Those particular articles were a little longer than I usually like to share for posts like this, but I needed to get a few things setup before actually diving into the main points of this series.

Case in point: In this post, I’m primarily going to be talking about how to communicate with the Google Maps API to simply display a map – that’s it. Nothing more. Sure, there’s a lot more that can be done, and I plan to cover a lot of that material, but for now we just need to get a map displaying in our template.

Continue reading

Integrating Google Maps in WordPress

As mentioned in the first post in this series, I’m going to be talking about a few of the different Google Maps APIs and how we can integrate them into our WordPress projects.

Rather than actually build a plugin that covers this material, I’m going to be creating a template to demonstrate some of this functionality. Though I’m a strong advocate for separating functionality and presentation, the work required to get a plugin up and running requires a lot of boilerplate code.

That isn’t inherently a bad thing, but I thought it’d be a chance of pace to simply introduce a template and then begin adding the necessary code from there (and making any changes to functions.php from there).

At the end of the series, we can then take a look and see how to abstract all of the work that we’ve done into a child theme to use.

Continue reading

Using The Google Maps API and WordPress

One of the challenges that comes with working with any new API is learning how to use it. And by that, I mean generally overcoming the learning curve – and I believe that this

Some libraries and frameworks have some relatively easy APIs once you grok the basics (and I think WordPress falls into this camp), and others don’t necessarily have the easiest APIs (such as, say, Google Maps).

The thing is, it’s different for all of us. What’s easy for me may not be easy for you and vice versa, and that’s okay. I think we need to stop treating one another as if it says something about our intelligence if we aren’t able to pick up something as fast as someone else.

That’s probably content for another post.

Anyway, for the past few months, I’ve been doing more work with the Google Maps API than I’ve ever done thus far in my career. All of the work as been done within the context of WordPress, but none of it has been WordPress-specific.

By that, I mean that the work that I’ve done is used within a WordPress plugin but there’s nothing that requires WordPress for it to run – the code could be abstracted and generalized into a standard PHP application and used.

I don’t write about that, though. I tend to keep my focus on what it’s like to work with WordPress in a professional capacity. So over the next few posts, I thought it might worth taking a look at some of the ways that you may want to employ the Google Maps API in your project, what it entails, and how to get started with it so you have some clue as to what you’re doing whenever you need to build something with the API.

Continue reading

The Best Way To Release a New Feature

When it comes to launching the final version of a product be it a theme, plugin, or a web application regardless of it’s built on WordPress or not, source code control can be a life saver.

This is why most developers live and die by the source control system that they use.

Before going any further, this isn’t a debate as to which is better – Subversion, Git, Mercurial, whatever – as long as you’re versioning and tagging the code that you’re working on, you’ve got something to rollback to using if something goes wrong with your latest build.

Imagine that you’re in the following scenario:

You’ve got a project that you’ve been working on for a few weeks or for a few months and it’s about to go live. Everything is working great.

Then, shortly after it launches, something needs to be changed. And this isn’t like a small grammatical change. Instead, this is a change that requires some major refactoring and possibly the re-architecting of a significant feature.

Sure, you hope everything goes well, but there’s far more to it than that if you want to it do it correctly.

So what is the best way to go about doing this? Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑