I’ve been quite busy as of late and the reason being larger than project workload and more 9-5 job duties. I’m still developing with WordPress and learning new tricks that I hope to share soon, just need the time to sit down and put the thoughts together. Also development and support of my Techozoic Fluid theme has suffered, which hopefully will also pick up after finishing a few of the extra projects I have going on. Just wanted to stay in touch with everyone in this great community.
While working on project an interesting problem arose, needing to pass an additional parameter to a WordPress filter. Normally filters only allow for a set number of parameters, but the particular filter needed an additional parameter that could be passed when calling the filter.
The problem was being able to run a WP_Query for a set number of days passed. This is normally accomplished with a simple filter that is applied to posts_where. The problem is the number of days would be variable, since it was being set via a widget option. To get around this using OOP and create a new class that stores the variable and that will be passed when calling the filter. While the example below is a specific solution to the problem above it can be adapted for pretty well any filter that needs another parameter that can be set when calling the filter.
After setting up a new VPS with MyHosting I noticed in the logs all the IP addresses belonged to CloudFlare. This is of course because CloudFlare proxies all the requests to speed up the site with it’s CDN. This is of little use when it comes to tracking down any malicious activity. Luckily there is an Apache module that restores the correct IP address to the log file. I’ll outline the process for getting the Apache module setup on the CentOS VPS.
After being with Dreamhost for a little under 2 years I’ve decided to switch over to MyHosting. I’d had been using Dreamhost’s VPS service for the past few months as their shared hosting had lead to all of my sites being hacked twice, along with poor performance all around. Everything started out fine with their VPS, then came the downtime. I understand the company is growing and some problems might be expected, but on more than one occasion downtime was into the hours. Even this fact was really the deciding factor, it was performance even on a VPS was poor and was constantly having to reboot. The prices for VPS memory upgrades were also terrible $25 for 512MB memory this is on top of the normal monthly hosting fee.
After looking at many, many companies I had a couple in mind. I finally made the decision to switch to MyHosting. I was able to get a VPS with 5 times the memory for much less than I was currently paying. Although storage and bandwidth are limited with the new hosting the prices for upgrades are reasonable. Currently I’d nowhere near exceed the current limits anyway. If your looking for a new host MyHosting, might be the way to go. I’ll update again after breaking in the tires on the new server.
Since the retirement of version 1.0 of Twitter’s API is underway, I’ve been updating the Twitter integration code in the Techozoic Fluid theme. I don’t agree with all the changes to the API, especially the requirement that all API requests, even for public info, must be signed. Luckily someone has already done the hard work creating a library for signing the requests with the proper oAuth signatures. The tmhOAuth library can be found on Github. It will be required for the new functions.
The first step is to register a new Twitter application. After signing into Twitter visit the Applications area of Twitter, and create a new application. After creating the application make sure create the access token at the bottom of the Application screen, this will authorize the application to access your account. You will now need 4 separate keys to properly sign the API requests. You’ll need the Consumer key, Consumer secret, Access token, and Access token secret. These will be added to an array and passed to the function and in turn passed to the oAuth library to sign the request.