WordPress Theme API with Guzzle

I spent a lot of time to translate my previous PHP code from cURL in Guzzle Http. So, beware because if you use Guzzle you have to use a request in multipart. For example, this was my previous code:

This is the Guzzle version. It works!

As usual, please don’t hesitate to leave any questions or comments in the feed below, and I’ll aim to respond to each of them.

Laravel Artisan Supervisor Command

Useful Laravel PHP artisan command to handle supervisor. Download here.

WordPress actions and filters in Javascript

Actions and filters are so awesome in WordPress. They provide a very simple and powerful way to customization the WordPress core. So, Plugins and themes can execute code before or after specified event or change the result of many core functions. On the web, I found few discussion about the Javascript porting of actions and filters. Continue reading WordPress actions and filters in Javascript

How to redirect the WordPress log to a file

Edit your wp-config.php file, located in WordPress root folder, and add or replace define('WP_DEBUG', true);

In this way WordPress will print the logs on the screen. This may be very annoying, so you would like to redirect all logs in a file.

As usual, please don’t hesitate to leave any questions or comments in the feed below, and I’ll aim to respond to each of them.

MySQL: random select in a pagination context

MySQL provides a very simple method to select rows in random order. It uses the ORDER BY RAND()statement. If you will be used theORDER BY RAND() statement, MySQL will create a temporary table with all results, then will be assigned a random index to each row and finally will return the random rows! This makes the ORDER BY RAND() quite slow. In fact, some developer prefers alternative techniques, such as PHP random functions or special SQL select.

Continue reading MySQL: random select in a pagination context

Very short trick: maintenance mode via IP

When you would like to show a page only for a specified user or you wish to create a maintenance page, you may use this simple script:

 

Xcode4: backward compatibility code

With Xcode 4 you can develop applications for iPad and iPhone. Also, you can choose a different iOS target. Currently, the last release of iOS is 4.3 and when you will create a new project you will see:

Now, the rootViewController property has been added with iOS 4. This mean that when we going to test the application in iOS 3.2 environment we will get a CRASH! Instead to check the iOS version, we can use a feature of Obejctve-C in order to check if a property exists:

As usual, please don’t hesitate to leave any questions or comments in the feed below, and I’ll aim to respond to each of them.

How to remove the admin bar in WordPress

The last version of WordPress provides a new toolbar in frontend view when you are logged in. To disable this feature you can add the following code in the functions.php file in your active theme:

Continue reading How to remove the admin bar in WordPress