Category / Notes

When working on a pre-existing version of a site, you may need to check if a style is already loaded. This, in and of itself, is not that difficult, but if it’s using an older version of a dependency, then it can get a little more complicated.

For example, let’s say that you’re building a plugin for an existing site. The existing site uses something like Font Awesome, but it’s using an older version.

The requirements call for some updated icons that aren’t available in the existing version. Furthermore, the version of Font Awesome maybe be the minified version or not so we need to check for that.

Read More

/ November 26, 2015 / Comments Off on Happy Thanksgiving!

Happy Thanksgiving!

Today, we’re celebrating Thanksgiving in the United States, so for those of you who are doing the same – Happy Thanksgiving!

For those of you who are not, I still hope you have an awesome day!

Read More

When retrieving data, there times where you may want to change the WHERE clause in WordPress. That is, depending on what you’re retrieving, you may want to filter what it’s searching.

And that’s exactly what a `WHERE` clause does. But just as we’ve looked at content in other posts, we can alter the `WHERE` clause via the WordPress API.

In previous posts, I’ve covered:

– Displaying the last query, which is useful when doing light debugging.
– Selecting `DISTINCT` records
– Performing a `JOIN` on two tables

Here, I’ll show how to use the API to change the `WHERE` clause so you’re not having to do so through a custom query.

Read More

In a previous posts, I’ve talked about how to:

– View the last query that WordPress executed
– Select `DISTINCT` records in WordPress

There’s a lot more to do than just viewing the last query and selecting distinct rows, though. For example, you can also JOIN two tables in WordPress without having to write raw SQL.

So to be consistent with some of the previous posts, I thought I’d share how to do this using the WordPress API .

Read More

If you need to write a query against the WordPress database, grab a reference to `$wpdb` and get to work, right?

In some instances, sure. I’m not opposed to this. After all, the API exists for a reason. But sometimes, I think we bypass built-in APIs. We go straight for `$wpdb` without looking to see if other hooks already exist.

If a hook exists, why not use it? It’s one level of abstraction above the database and it uses the native API.

As mentioned in a previous post, I want to cover a few ways to customize queries that run against the database.

Case in point: selecting `DISTINCT` records from WordPress.

Read More