Automated server configuration with Ansible

In this series of articles, we’ll be automating server (VPS) configuration with the help of Ansible, an open source IT automation platform. Interested in not having to install and set up Apache/Nginx, PHP and MySQL with WordPress on your VPS servers manually? Then read more!

But first, let me tell you a short story of how I got here. Continue reading “Automated server configuration with Ansible”

Custom routing mechanism in WordPress themes (MVC like)

I had a need to implement custom routing system in my WordPress theme. I’m developing a web application, not a typical theme. There is a predefined set of pages in the app and each of them has its own view (template). Ideally, the design and structure (HTML/CSS) of these templates are located in files, not in a database. They can be versioned in Git that way. Nonetheless, I still have to insert the pages with corresponding page template settings into the database. Why? Continue reading “Custom routing mechanism in WordPress themes (MVC like)”

Staying at the top of the WordPress game

In the WordPress world, things move and evolve quickly. Tens — sometimes hundreds — of new issues pop up each day. Modifications to WordPress Core happen on daily basis. The community is vibrant, doing something all the time. That’s good. What’s even better is to start following these changes. You could become a better WordPress developer that way. Which sites, blogs and resources to subscribe to, though? Continue reading “Staying at the top of the WordPress game”

Beautiful web design frameworks

For my upcoming WordPress-based web application I need to create a nice design of its front-end. The first step is to wireframe the site so you have a basic idea of its layout. After that, the wireframes are transformed into a usable and appealing design. Nowadays, there are plenty of HTML/CSS frameworks which can constitute the basis for the web pages design. Going through countless sites, I’ve selected a few which really got my attention. Let’s look at them! Continue reading “Beautiful web design frameworks”

PHP error reporting and logging

Logging and error reporting are parts of a debugging process. For some programmers, putting

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('SAVEQUERIES', true);
define('SCRIPT_DEBUG', true);

in the wp-config.php file is the end of the story. Let’s discuss how we can improve the debugging process of our WordPress-based web app. Continue reading “PHP error reporting and logging”

Better WordPress profiling with xhprof and $ignoredFunctions

Are you profiling your WordPress-based web application/site with xhprof? Go read my other article about how to install and configure xhprof profiler with WordPress. Even if you are already familiar with xhprof, there is a small but important problem: the profiling results are unnecessary bloated.

Figure 1:  Bloated Expensive Calls Chart
Figure 1: Bloated Expensive Calls Chart
Figure 2:  Bloated table
Figure 2: Bloated table

Continue reading “Better WordPress profiling with xhprof and $ignoredFunctions”

add_filter

Global function add_filter is an integral part of WordPress core. Together with the function apply_filters, you can extend WordPress core, plugins and themes without touching a single line in them. Thanks to this, updates become straightforward — just copy and replace the old code with the new one.

I’ll be explaining sections of WordPress core, line by line, in a series of articles, starting with this one. These topics will be of technical character. If you want to read about how to use this and that, I’ll include links to other resources at the end of each article. Continue reading “add_filter”

Profiling WordPress with xhprof on Mac OS X 10.10

A WordPress site usually comprises a theme and many plugins. If loading speeds and server load are fine for you, congratulations. Otherwise, you have to profile your WordPress-based application. Simply put, profiling means to measure how much CPU time and memory each executed function took. Let’s say you create a custom function to count from 1 to 1000. After running a PHP profiling tool, you would find out that your function took 1 millisecond of CPU time and 100 bytes of memory to complete (made-up numbers). Due to the fact that we are talking about profiling the WordPress and its plugins plus a theme, we need a high-quality software to do it. xhprof, originally developed by Facebook, is the PHP profiler. In our guide, I’ll walk you through steps necessary to install, configure and run xhprof on your WordPress site. Continue reading “Profiling WordPress with xhprof on Mac OS X 10.10”