Monthly Archives: September 2011

Don’t start emails with “Y U No Use [Insert Service Name]”

 

The subject line above, sadly is the subject line of an email I got last week from a service emailing to ask why TheInterviewr doesn’t use them for it’s Telephony work.

First of all, I only use services that I trust, since I’m asking my users to trust them as well, and for all my Telephony services, I only use or recommend Twilio. That will never change, as they have served me well on various projects for nearly two years now (Good job guys).

This other nameless service offers similar features, but I’ve never used them, and I’ve only heard mixed reviews about them. So while I may have considered them for a smaller project, the fact that they actually send an email were the subject line starts out as “Y U No Use Blank” isn’t really a confidence builder, so I promptly file them in the never going to use folder.

But as I thought about it, it seemed that this was worth writing about… If you are a professional business.. Trying to build confidence and trust in your service.. Why… Why would you actually use a subject line like that? It’s practically asking to never be taken seriously, and if I can’t take your seriously, then I won’t even evaluate your service to consider using it at some point.

 
 

WordPress: Search By Post and Meta Fields

 

If you’ve ever had to search custom post types, this function will come in handy:

function search_by_post_and_meta_fields($args) {
    global $wpdb;
    $defaults = array(
        'post_type' => 'post',
        'post_fields_to_search' => false,
        'meta_fields_to search' => false,
        'search_term' => false
    );
    extract(wp_parse_args($args, $defaults));
    if(($post_fields_to_search or $meta_fields_to_search) and $search_term) {
        $ids = array();
        $query = "SELECT DISTINCT $wpdb->posts.ID
        FROM $wpdb->posts
        LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)
        WHERE ($wpdb->posts.post_status = 'publish'
        AND $wpdb->posts.post_type = '$post_type') AND (";
        $where_parts = array();
        if(is_array($post_fields_to_search)) {
            foreach($post_fields_to_search as $field) {
                $where_parts[] = "$wpdb->posts.$field LIKE '%$search_term%'";
            }
        }
        if(is_array($meta_fields_to_search)) {
            foreach($meta_fields_to_search as $field) {
                $where_parts[] = "( $wpdb->postmeta.meta_key = '$field' AND $wpdb->postmeta.meta_value LIKE '%$search_term%' )";
            }
        }
        if(count($where_parts)) $query .= implode(' OR ', $where_parts);
        $query .= ") ORDER BY $wpdb->posts.ID ASC";
        $results = $wpdb->get_results($query, ARRAY_A);
        foreach($results as $result){
            $ids[] = $result['ID'];
        }
        return $ids;
    }
    return false;
}

Then in your template, you just call it like follows:

$args = array(
    'post_type' => 'listing',
    'post_fields_to_search' => array('post_title', 'post_content'),
    'meta_fields_to_search' => array('_tags'),
    'search_term' => 'hello'
);
$post_ids = search_by_post_and_meta_fields($args);
foreach($post_ids as $post_id) {
    $post = get_post($post_id);
    setup_postdata($post);
}
 
 

Video: Nigel Marsh on Work-life Balance

 

Interesting Ted Talk from Nigel Marsh

This week we look at Nigel Marsh: How to make work-life balance work by Nigel Marsh. In this video he lays out an ideal day balanced between family time, personal time and productivity — and offers some stirring encouragement to make it happen.