How to Quickly Add Breadcrumbs in Thesis

On one of my WordPress and Thesis powered websites I wanted breadcrumbs to help visitors navigate. I felt this was especially important because the site is a traditional website using pages, rather than a blog using posts.

I quickly discovered the Breadcrumb NavXT plugin which cleanly did exactly what I wanted, including integrating with themes by adding a function. I downloaded and installed the plugin. I customized the settings in the site’s dashboard then moved on to the final step: integrating the plugin with Thesis.

Here’s how to add a function to Thesis to make the breadcrumbs appear below the header.
[Read more…]

How to Display Content Based on WishList Member Level

I created a PHP function for my GenealogyTools.com blog last night. It may save you some time if you want to control what content displays for different WishList Member member levels.

I use the Thesis theme, so I added the function to custom_functions.php and use it for an after post hook and to control the display of sidebar widgets.

Here’s the function:


function is_user_premium_member() {
$user = wp_get_current_user();
$levels = WLMAPI::GetUserLevels($user->ID);
if(in_array('Premium', $levels)) {
return true;
}
else {
return false;
}
}

This function determines whether the user is in the Premium membership level. You can make it check for a level with different name by changing the value ‘Premium’ to whatever your membership level is (e.g. ‘Gold’).

Once you have the function saved, you can use it in the “Conditional” text box of a widget. To exclude the widget for the membership level, enter: !is_user_premium_member(). To only display it for the membership level, leave off the exclamation point: is_user_premium_member().

Similarly, you can use the function within a hook like I have in the following example of an a single post advertisement hook:

/* Ad after single posts */
function single_post_ads() {
if (is_single()) {
if(!is_user_premium_member()) { ?>

// Put what you want to display for non-premium members here

In this case, taking out the exclamation point will make the ad display only for premium members.

GAE Problem Uploading Data After 1.5.2 SDK Update

Naturally the 1.5.2 update of the Google App Engine (GAE) SDK on my MacBook cleared my datastore. That’s a big deal right now as I’m into the last week of development on the mobile app I’m building for attendees of the 2011 Rethinking Everything conference.

Weeks back I completed the bulkdata load to the production server so I periodically download the current datastore and upload it to my local datastore. Fortunately, I did that earlier today. Unfortunately, the upload failed after updating the SDK.

At the end of the stack trace was this error:

BadRequestError: app "dev~rethinkingprogramapp" cannot access app "rethinkingprogramapp"'s data

The fix is simple if you run into this. Simple, that is, if you read the release notes. The application name in the SDK is now prefixed with “dev~” so prepend that to your app name for the –application argument to bulkdata load commands.