“Engineers instinctively measure their days by what they built.” – Rands
While I plan to continue full-time development and consulting, I will build and sell software as a service in 2012.
“Real artists ship” – Steve Jobs
“Engineers instinctively measure their days by what they built.” – Rands
While I plan to continue full-time development and consulting, I will build and sell software as a service in 2012.
“Real artists ship” – Steve Jobs
WP eCommerce offers a feature where an email is dispatched to the administrator when an order is completed. WP eCommerce calls this email an “Admin Report”.
These emails are useful for order fulfilment, but they are lacking a key piece of data that you may need to fulfill an order: the product’s SKU.
Fortunately, there’s a way to include the each product’s SKU in the Admin Report. To accomplish this, you need to edit file within the plugin folder: wp‑e‑commerce\wpsc‑theme\functions\wpsc‑transaction_results_functions.php
In this file find the following code around line 235 (in version 3.8.6):
$report_product_list.= " - " . $row['quantity'] . " " . $row['name'] . " " . $message_price . "\n\r";
And paste the following line in it’s place:
$report_product_list.= " - " . $row['quantity'] . " " . wpsc_product_sku($row['prodid']) . " " . $row['name'] . " " . $message_price . "\n\r";
With this change, the SKU will be added to your Admin Report after each item’s quantity.
Please remember: you may need to edit this code with each WP eCommerce update, so please bookmark this page.
With their new website design, Lifehacker lost me as a reader. And I wasn’t alone—the readership of lifehacker.com dropped almost 40% since the redesign.
Gawker and Lifehacker maintain an old “blog” layout at blog.lifehacker.com, but unfortunately there’s no way to set the “blog view” as your default view.
It would be nice if these URLs could be rewritten on the fly though, eh? Well, they can be with the X-Rewrite extension for Google Chrome!
The URL Rewrite extension has a simple configuration screen with three input fields that allow you to use regular expressions to redirect one URL to another.

The “Pattern” is:
(.*)://lifehacker.com/(.*)
The “Rewrite” pattern is:
$1://blog.lifehacker.com/$2
And voila, Lifehacker is back to it’s old self and has me back as a happy reader!
There instances where a WordPress developer may need to test whether a specific post is a Custom Post Type. You can test whether a post is a specific Custom Post Type from within the loop, outside of the loop, or from within the Single Post view (single.php, single-*.php, and more).
In this example, we will be using the get_post_type() function to determine whether a post is a ‘photo’ or ‘illustration’ Custom Post Type.
if ( get_post_type() == 'photo' ) { echo 'Post is type: photo'; }
elseif ( get_post_type() == 'illustration' ) { echo 'Post is type: illustration'; }
To test for a Custom Post Type from outside of the loop, we need to know the post_id. In this example, the post_id we are testing is “1″.
if ( get_post_type(1) == 'photo' ) { echo 'Post is type: photo'; }
elseif ( get_post_type(1) == 'illustration' ) { echo 'Post is type: illustration'; }
The built-in WordPress function is_singular() will test whether any of the following is true for a page: is_single(), is_page() or is_attachment(). The is_singular() function also has the ability to test whether a page is a specific type. You can test whether a page is a blog post or a ‘photo’ type in the following example:
if ( is_singular('post') ) { echo 'Post is type: post'; }
elseif ( is_singular('photo') ) { echo 'Post is type: photo'; }
elseif ( is_singular('illustration') ) { echo 'Post is type: illustration'; }
You can also test a page against any number of Custom Post types by using arrays:
if ( is_singular(array( 'post', 'photo', 'illustration' )) ) { echo 'Post is type is either: post, photo, or illustration'; }
You can learn more about the WordPress functions used in this post (get_post_type() and is_singular()) at the WordPress.org Codex.
Some users of WordPress 3.0+ have a problem saving menus with more than 16 items. No error is displayed, but some menu items are missing when the menu is saved. If this is happening to you, your web server may have the Suhosin Hardening-Patch or Suhosin Extension for PHP installed.
Suhosin is an advanced protection system for PHP installations. It was designed to protect servers and users from known and unknown flaws in PHP applications and the PHP core. Suhosin comes in two independent parts, that can be used separately or in combination. The first part is a small patch against the PHP core, that implements a few low-level protections against bufferoverflows or format string vulnerabilities and the second part is a powerful PHP extension that implements all the other protections.
The (probable) reason for this is that your suhosin.post.max_vars and suhosin.request.max_vars options are set too low. Ask your host to increase the values on these options.
If you host the website yourself, you’ll need to edit your php.ini file (located in /etc/php5/apache2/php.ini on Debian Linux servers). Simply add these lines to the bottom of your php.ini:
suhosin.post.max_vars = 5000
suhosin.request.max_vars = 5000
And voila, you should be able to save menus with more than 16 items!
Copyright © 2010—2012 Steven John Strutt. All Rights Reserved.