Software Engineering in WordPress, PHP, and Backend Development

Category: Tips (Page 2 of 10)

Various articles covering anything from how to programmatically achieve a certain task to useful ways that I’ve found to manage my time.

Using Terminal in Coda 2

Most developers in the WordPress space have their favorite IDE of choice. Ask around and you’re likely to hear people share their favorite editors being:

And these are all great options. For what it’s worth, I dig the fact that we have choices when it comes to the tools with which we work.

But I’ve been a fan of Coda ever since I moved to Mac. This doesn’t mean it’s not without its shortcomings. For example, I use a third-party application to do debugging but it’s not that big of a deal.

Terminal in Coda 2

Anyway, one of the things that I’ve noticed with people who opt to use Coda don’t use it to its fullest extent. That is, there are a lot of features I see other developers opt not to use (like the database front-end).

I don’t know if it’s because they don’t know it exists or because old habits die hard. Either way, another example that I rarely see is the terminal in Coda 2.

Continue reading

Quick Tip: An Alternative To file_get_contents

One of the more common PHP functions developers use in order to make remote requests is file_get_contents. The function makes it easy to send requests to another URL and then handle the response.

It’s especially handy if you need to make an Ajax request to another site but aren’t allowed to do so from the client-side because of cross-site-scripting.

That said, cURL is often a better option than file_get_contents because it gives you far more control over the options that are set when setting up the request to be made. file_get_contents simply doesn’t do that. Instead, it provides enough options for making simple GET requests.

No, not that kind of curl.

No, not that kind of curl.

For these reasons, it’s often a good idea to use cURL when you need to provide a more fine-tuned request. Even more so, it’s helpful to have all of the functionality wrapped up in a utility function you can drop in your project whenever you need it.

Continue reading

Get Values of Multiple Elements in jQuery

There are a number of JavaScript libraries and frameworks available right now – more than there have ever been before – and I think that’s a great thing.

If you’re a WordPress developer, odds are you’ve worked with at least one of three variations of JavaScript:

  1. jQuery since its included as part of core as is the choice library for the front-end
  2. Backbone since its also included as part of core and is used in features like the Media Uploader
  3. Vanilla JavaScript because sometimes the rest is overkill

And if you’re building advanced themes, plugins, or even web applications with WordPress, then odds are you’ve had to do some fancy stuff with JavaScript (using one or none of the aforementioned libraries). One of the challenges we face, though, is there’s no formal documentation of how to use jQuery within the context of WordPress core.

Should there be, though? I mean the jQuery Documentation is solid.

jQuery API

Anyway, one of the things I’ve stumbled across when writing my own code or in performing code audits is the way in which some developers attempt to get values of multiple elements in jQuery. Though there are some ways that work, there are always some options better than others.

Continue reading

Quick Tip: WordPress Helper Functions For Templates

A little over a week ago, I shared a post about one way I try to work well with designers when working with WordPress. That is, I talked about how of stubbing out files they may need in order to get their work done.

Starting Up a Plugin

As mentioned in the post:

There are plenty of tips that can be shared and I’ll probably share more in the future.

So I thought I’d try to make this a regular thing by continuing to share some of the things I’ve learned – both what to do and what not to do – when partnering with designers or I’ve learned when simply working alone or with others on WordPress projects.

And one of the things I’ve found to be helpful is to provide helper functions when needing to call into more complicated functionality.

Continue reading

Quick Tip: A Way to Work Well With Designers

If you’re a developer working in WordPress, then odds are you’ve spent time working with designers. Assuming you’re working with a good designer, it can be a lot of fun.

I think we’ve all had our share of experiences both good and bad (and luckily I’m at a point where I’m working with some really great designers), but I think there are things we – as developers – can do to help make our designers jobs a little bit easier.

Continue reading

« Older posts Newer posts »

© 2024 Tom McFarlin

Theme by Anders NorenUp ↑