Open/Close Navigation

Articles by ‘Daniel Pataki’

How to Delete A WordPress Post Using AJAX

AJAX is an extremely powerful tool for bridging the gap between your server side code and your client-side code. It enables you to not only make better interfaces and more useful tools, but to lower your bandwidth usage and optimize your code while you’re at it.

While AJAX can be implemented freely anywhere, WordPress has built-in support for it, and there is a standard way to use it in your themes and plugins. Let’s take a look at the steps necessary to get going with AJAX.

The AJAX Flow

As you may well know, to create something useful using AJAX you’ll need a few things:

  • An action which triggers the call
  • An AJAX call
  • Server side code which is executed
  • Javascript code which processes the result

Not all these steps are required all the time, but in general this is how it goes. Let’s continue by thinking up a scenario where AJAX would be useful.

Read More »

How To Internationalize WordPress Themes

If implemented from the start of a project, making your themes translatable is so easy, there’s just no excuse not to do it! As the owner of a theme workshop I can tell you that one of the top questions we get is “is this theme translatable” so internationalization is far from being a trivial matter.

The Basics Of Internationalization

In a nutshell all you are doing is replacing your hard-coded strings with functions. ‘Hello World’ becomes __( 'Hello World', 'mytranslations' ) and that’s it. This function checks if a translation exists for the first parameter; if it does, the translation is used – if it doesn’t, the first parameter is output as is.

Read More »

How to Interact With the WordPress Database

WordPress is one of the best blogging platforms and general CMS systems out there. Its flexibility is a testament to the amazing codebase behind it. In this article, I want to take you to one of the “deeper” areas of the system, the $wpdb class.

The $wpdb class is a simple utility for interacting with the database directly. If you’ve been around WordPress code you’ve probably seen the get_posts() function or the WP_Query class. These let you retrieve posts in a flexible fashion, but sometimes you just need more. The $wpdb class lets you add/modify/delete any data in WordPress modularly, making it a very powerful tool. Be careful though, with great power comes great responsibility (and awesome features).

What Is wpdb

Wpdb is a class which is based on the ezSQL class by Justin Vincent. It provides an easy way for us to talk to the WordPress database. $wpdb is am instance of this object. It is created ny WordPress, all you’ll need to do is start using it.

Servers Room

Read More »

A Comprehensive Guide to Becoming a WordPress Developer

Since WordPress is one of the leading content management systems out there it spurs countless people to become developers themselves. Some of the best I know in the industry emerged from these “DIY developers” – people who started looking at code as a hobby.

WordPress is a good medium to start out in because its functions are clear, the coding style is extremely transparent and easy to understand and the documentation is phenomenal (not to mention the huge community). With this article I hope I can give you a quick primer on where to start your long but – hopefully – fun journey!

Note to developers: There are quite a few instances where what I explain is not the full story. This is what Terry Pratchett calls “Lies to children”. It is difficult to explain programming concepts to beginners by going into maximum detail. When you learn acceleration in school you are not told that this is actually integral calculus, the sum of the area under a graph. You simply learn the result (speed over time). The idea is the same here :)


Read More »