My name’s Chris Garrett. I craft effective user experiences for a range of digital platforms from my Bristol base in the UK.

Recent work.

A bit about…

Although my primary focus is in user-experience design, the range of skills it entails is incredibly diverse. Everything from Human-computer interaction to graphic design, information architecture and accessibility rest firmly in my skillset. So whether you're looking for someone to help build the blueprints of your web app or create a brand to sell it, feel free to get in touch.

More services »

From the blog.

  1. Making users searchable in Wordpress

    Posted 2 months, 1 week ago and tagged as ,

    For a soon-to-be launching client project I needed the Wordpress built in search to return, not just post and page content, but also users that match the users query string. I couldn’t find a plugin that facilitated this so put together the following code snippet to handle it:


    <?
    $authors = $wpdb->get_results('SELECT * FROM '.$wpdb->users.' WHERE user_login LIKE "%'.urldecode($_GET['s']).'%"');
    if(!empty($authors)){
    ?>
    <h2>Authors matching your query</h2>
    <?
    foreach($authors as $author){
    $bio = $wpdb->get_results('SELECT * FROM '.$wpdb->usermeta.' WHERE user_id="'.$author->ID.'" AND meta_key="description"');
    $bio = $bio[0]->meta_value;
    ?>
    <div class="search-result">
    <h3><?=$author->user_login?></h2>
    <?=apply_filters('the_content', $bio)?>
    </div>
    <?
    }
    ?>

    Read on » 2 Comments