Replacing Reader, Part 1: What’s the Big Deal?

If I may borrow from Judith Viorst, March 13th, 2013 was one of those terrible, horrible, no good, very bad days. There were no lima beans involved, but that was the day Google announced it was pulling the plug on Google Reader.

Along with Gmail, Reader is one of the very few web services I use virtually every day. RSS and I go way back, at least ten years; I recall that when I was finishing up my library technician diploma, one of my final projects was based on RSS. I’ve been kind of an evangelist ever since – in the law library where I worked, my boss and I offered lunch ‘n’ learns about “those little orange icons”, and Steve‘s enthusiasm for and creativity with the technology was one of the big reasons we clicked as colleagues.

My first RSS aggregator was Bloglines, which I loved. But as they say, nothing lasts forever, and after a few years, it became clear to most Bloglines users that they’d need to find a new solution. When I finally made the switch in 2008, the transition was not that hard. Sadly, Bloglines had become so unpredictable that it was a pleasure to use a new, if unfamiliar, service (Google Reader) that actually worked, even though I wasn’t in love with it. But somehow, through daily personal and professional use of Google Reader, I became a huge fan. So, when I heard the news it was being axed, I genuinely felt anguished.

I’m not alone. Martha Sperry recently wrote,

“I have had an awful lot of loss recently. Some quite personal, and some smack in the public eye. Take, for instance, the untimely (although not unexpected) demise of perhaps my all time favorite web tool, my secret weapon in the pursuit of knowledge, my endless font of material for my beloved blog, my source of inspiration and enlightenment. Yes. I am talking about Google Reader.”

Tweet after tweet, post after post – folks felt angry, distraught, and dare I say, betrayed by Google’s announcement. Immediately, every tech site worth its salt was offering up lists of potential replacements, but few really had any concrete endorsements.

It surprised me how vexed I was by the loss. Thankfully, there were still several months to go before Google pulled the plug, so I opted to let the news sink in, and take my time in finding a solution. This 3-part series will detail my experiences in finding a replacement for Reader. Check back next week for Part 2.

WordPress Wednesday: Automated Backups with BackWPUp

Geek Factor: 2

This week’s WordPress Wednesday is a quick ode to the plugin BackWPUp, which we’re current testing out on a handful of our websites. I’ve only been using it for a few weeks, and already I would recommend it as an excellent automated backup tool.

backwpup

Having backups of your site can be valuable if anything goes wrong; they can be a downright lifesaver should your website ever get hacked.

At Stem, we’re using the plugin to back up sites to a separate FTP space, but you can also store it on the same server as your website, or download it to your computer on demand. BackWPUp allows you to specify how many copies of each backup operation you’d like to keep at any given time, so you don’t run out of storage space.

For database backups, BackWPUp lets you select which tables you’d like to back up, rather than taking the whole database. It also can run database checks, optimization and repairs when it creates the backups. If you prefer your backups in XML form, BackWPUp can be set to create an XML file of all your WordPress posts and pages.

One of the big pluses with this plugin is that it allows you to schedule separate backups; this means databases and uploads which, arguably, change the most often, can be backed up more frequently than the site’s theme. Last but not least, BackWPUp also keeps detailed logs, so you can see whether or not the backup has run on time, and if any issues cropped up during it.

If you don’t already have a solid automated backup tool for your WordPress website, I highly recommend that you check this one out. If you already have another plugin/setup that you love, it’d be great to hear about it — please share in the comments below!

Terry O’Reilly on Hyper-Targeting

If you’re a fan of Terry O’Reilly’s wonderful radio program, Under the Influence (previously called The Age of Persuasion), you might have caught this weekend’s show on hyper-targeting. If not, be sure to check out this episode, which is summarized pretty nicely in the blog post, but is even better in audio thanks to O’Reilly’s dulcet tones.

The episode describes how advertisers have adapted to selling on the internet, from the invention of browser cookies in 1994 to data scraping and real-time conversation monitoring on Facebook today. There are lots of fascinating little tidbits in here on advertisers’ ever-growing capacity to accurately profile potential clients. I was particularly intrigued by the story of an analyst who studied the purchases of Canadian Tire credit card holders: he found that “people who bought carbon monoxide detectors, premium birdseed, or felt pads for the bottom of furniture legs almost never missed payments” but those “who bought chrome skull car accessories or ‘mega thruster exhaust systems’ were credit risks.”

O’Reilly concludes that

“80% of people don’t want to be tracked online. Yet it’s safe to say almost 100% of consumers are. …  Some people are fine with giving away personal information on the Internet. As one friend said to me, it’s the price of a free Google and Facebook.

But it’s important not to be apathetic about your data. The more you understand how it all works, and where it’s heading, at least you can begin to exert your own influence on the software engineers, financial statisticians, numerical analysts and data scientists who are tracking you.”

See: Hyper-Targeting: How Brands Track You Online.

WordPress Wednesday: Query Posts by Custom Field Parameters

Geek Factor: 5

This WordPress Wednesday is part three of our epic series of Custom Field tricks, which has also included fawning over the excellent Custom Field Template plugin, and showing how we at Stem use Custom Fields in our internal and client projects.

In this post, we’re going to cover how to query posts by custom field parameters using the WP_Query class.

First, a quick review how to use WP_Query — for more information, check out this Greenhouse post from last year, or check out the invaluable WordPress Codex.

The WP_Query class allows you to create a brand-new query, rather than the default ones generated by WordPress on each post/page, and define the parameters however you see fit. This query is stored in a variable, and then can be used in the Loop by prefacing each step with the variable’s name.

In the example below, we stored the new query in a variable called $myCustomQuery. When we want to use that query in the Loop, we just need to include the $myCustomQuery-> variable (ie. $myCustomQuery->have_posts()).

Below we’re creating a new WP_Query and using it to query the five most recent posts in the ‘News’ category:

Using WP_Query and Custom Fields Values

Using custom field parameters in the WP_Query works much the same way.

To query posts that have specific custom field filled out, regardless of value, use the meta_key parameter — this would return all posts with a value (any value) for the custom field with the key ‘lunch’:

You can also query by custom field values, regardless what field they’ve been added to — this returns any post with a custom field value of ‘sandwich’, regardless what field it appears in:

To query posts with a specific custom field and value, pair the meta_key parameter with the meta_value parameter — below will return all posts with the value ‘sandwich’ for the ‘lunch’ custom field:

It’s also possible to exclude certain custom fields or values from your queries, using the meta_compare parameter. As a default, the meta_compare operand is = (equal to) to compare the meta_value, but there’s also != (does not equal), > (greater than), >= (greater than or equal to), < (less than), and <= (less than or equal to).

For example, below we’re querying posts that do NOT have the value ‘sandwich’ in the ‘lunch’ field:

$myQuery = new WP_Query(array('meta_key' => 'lunch', 'meta_value' => 'sandwich', 'meta_compare' => '!='));

In WordPress 3.1 and higher, there is also the meta_query parameter, which allows for one or more arrays of custom field information to build queries from — using meta_query, the above query would look like this:

Using meta_query works much the same as the separate meta_key, meta_value and meta_compare parameters, though it is formatted a bit differently. One thing to note is even when the meta_query value is technically a single item (the array that houses the associated key, value and compare), it’s still necessary to place it in an array as well.

The key and value parameters work the same as the meta_key and meta_value parameters in the earlier examples, although the value parameter allows strings as well as numeric arrays to display range for compariables. Compare is much like meta_compare, but also allows for the values BETWEEN and NOT BETWEEN, EXISTS and NOT EXISTS (in WordPress 3.5 and higher), LIKE and NOT LIKE, and IN and NOT IN.

Unlike using meta_value in your query, meta_query also allows you to combine multiple custom field queries. Below we’re querying for posts with the custom field ‘lunch’ and the value ‘sandwich’, and posts with the custom field ‘total’ with a value from 1 to 10:

Now, Back to Those Lawyer Profiles and Practice Groups

Flip back to a couple of weeks ago, where we used the Custom Field Template to set up the practice areas to appear in the lawyer profiles as Custom Fields.

This enabled us to display the different practice group each lawyer belonged to on their profile pages, and have that Custom Field Template list automatically update when new practice areas pages were added to the site.

As was explained in that post, you can then display that list or practice areas on each lawyer profile by using the get_post_meta() function.

By querying pages using the custom field parameters, it’s also possible to pull this information in a ‘reverse’ fashion, and display the names of each lawyer that has a practice group checked on the practice page itself, even though that association has only been made in the lawyer profile custom fields.

Remember, the Custom Field Template that displayed the Practice Areas in our Lawyer Profiles had each practice area page’s ID as its value, rather than the title, making it possible to query the profiles with the current practice area’s page ID as a meta_value:

The output for this code would look a little like:

practice-group-members

Of couse, you could display any information that can be pulled from a standard WordPress post query. On our own projects, we’ve pulled basic job titles and contact information for Bernard & Partners, and added images for Waterstone Law.

I’d love to hear if anyone else has been using custom fields on their projects. Please share in the comments below!

Too Impatient for Video? Try Short Cutts

theshortcuttsGoogle’s head of webspam, Matt Cutts, has given us the goods on Google’s view of SEO through more than 500 Q&A videos since 2009. But web marketing and development agency ClickConsult says that “While the videos are great, sometimes the guy just needs to get to the point.” To that end, they’ve created a very cool website that distils the advice from each Cutts video into an ultra-brief answer – hence, “The Short Cutts“.

You can browse Cutts’ videos or search for keywords, and each video is annotated with the question and a quick answer -  just one word or short phrase. Given that Cutts’ video usually run between two and five minutes (according to Barry Schwartz of Search Engine Land), this saves a considerable amount of time. Pointless but fun bonus: you can also sort the videos based on what colour of shirt Cutts is wearing!

Schwartz says this site is “exactly what Matt Cutts and Google means when they talk about creating value add on someone else’s content.” Nicely done, ClickConsult, nicely done.

Short & Sweet: Google’s New SEO Cheat Sheet

A new cheat sheet from Google Webmaster Tools says that website optimization comes down to three basic things: look good in the search results, help Google understand images, and update and keep going – that’s it!

Google SEO Cheat Sheet

Google’s new one-page SEO cheat sheet for beginners

This one page publication, dubbed a “first-steps cheat sheet for friends and family” – in other words, for folks who have just set up a blog or website for the first time, but who haven’t really given search much thought – gives concise tips on how to optimize your website, complete with illustrated examples.

Under “look good in the search results”, site authors are encouraged to use descriptive page titles, reader-friendly URL structures, and unique meta descriptions. Helping Google understand images is as simple as using short, descriptive file names, employing the “alt” attribute, and including image captions. And to explain “update and keep going”, Google uses an analogy: “Your website is like a virtual storefront. You wouldn’t leave a store unattended for 6 months, right? Keep your site fresh by starting a blog, announcing new products, sales, and special offers. Remember to put yourself in your customer’s shoes and make sure you provide them with the information they need.”

To anyone with any amount of SEO experience, this is pretty basic stuff. But it’s a great resource for anyone who’s intimidated by Google’s more sophisticated SEO resources, and overall, serves as a good reminder of the key elements of good website optimization.

WordPress Wednesday: Custom Field Templates Part II – Using PHP in Your Templates

Geek Factor: 5

In the last WordPress Wednesday, we talked about the Custom Field Template plugin. This week, we’re going to go into a little more detail about this plugin, which was developed by Hiroaki Miyashita; specifically, we’re going to talk about how to incorporate PHP into the custom field templates that you build.

Let’s start with the Lawblogs.ca example mentioned in part one — specifically, our ‘Clawbies Year’ checkbox list. On Lawblogs.ca, this is used to indicate which years a blog has won a Clawbie award:

A basic way to set up the Custom Field Template for these checkboxes would be like this:

This code works great, and it’s obviously very simple to set up. The downside is that I will have to remember to update it each year to keep the list usable. Obviously, it’s not a hardship to type a hashmark followed by four numbers every 12 months, but this is where using PHP with Custom Field Templates can be super handy.

In the ‘PHP Code (Experimental Option)’ panel of the plugin, you can create PHP that generates the values for different Custom Field Template options.

For example, to have our years automatically update, we can create a loop that goes from our starting year (in this case, 2006) and ends on the current year (which we can get using the PHP date() function. Using the PHP range() function, we can generate a value for each of the years between 2006 and the current year, 2013. Lastly, we can put that range in a foreach() loop, and store each year value in the $values[] array, which will be used by the Custom Field Template plugin:

php-experimental-code

Each PHP Code you include is assigned an ID based on the text box it’s entered into. Above in the screenshot, the PHP code has been entered into a textarea titled Code #0 — each additional PHP Code textarea has its own ID number. This is how you assign that particular code to one of the Custom Field Templates.

Using the ‘Clawbies Year’ example from above, we would replace the written-out ‘values’ with which PHP ‘code’ we’d like to use:

Voila! Now our ‘Clawbies Year’ checkboxes will always be up-to-date.

1,200 words seems a bit excessive for a post about generating eight numbers.

Fortunately, this isn’t the end of what can be done with the PHP Code feature. One of the most powerful tricks I’ve found involves pairing WordPress queries with the simple PHP Code example above to create dynamically updating dropdowns and lists.

One common example we use often on websites at Stem is querying pages from different sections of the site. For example, when building a law firm website, it may be required to list the different practice groups that each firm member belongs to. In this example, we’re going to assume the fairly-standard set up of having the practice area pages share the same common parent page.

Using PHP in the Custom Field Template, you can first create a query of all of the practice pages on the site.

The above code would go into a separate textarea under PHP Code than the first example — although the Custom Field Template PHP Code section only starts with one textarea, once you add text to it a new one is added; this continues as you edit each new textarea:

php-experimental-code2

In this example, we’re using the $values[] array, which stores the IDs of the practice area pages. We’re also using the $valueLabels[] array — this one isn’t necessarily required, but it makes it possible to display a different label with each option than the actual value. In this case it’s very helpful, as the values we’re storing are the page IDs (I don’t know about you, but I don’t often memorize the IDs of every page on sites I build). This way, we can store the IDs as the values, but display the practice area page titles with the checkboxes, so it’s clear which page is which.

The PHP Code can then be used in a similar fashion as the ‘Clawbies Year’ example above — you could also use radio or select inputs for single select options. Note that the code below matches the ‘Code #1′ of the textarea the Practice Area PHP code is stored in:

The output for this Custom Field Template would appear on the lawyer profile pages as follows:

php-code-output-practice-areas

Best of all? Each time a practice area is added to the site, this list will be automatically updated to include it on every profile that uses this template.

Because we’ve set the ‘value’ of each checkbox as the page’s ID (rather than the page’s name), we can do more than display the practice area names — we can include links, or a quick excerpt — anything that could be displayed with a regular WP_Query().

Here is a simple example that displays the page’s title and content, followed by an unordered list of the ‘Practice Areas’ checked in the Custom Field Template:

Visually, the output would look something like the following:

practice-groups

Note: You can learn more about WordPress’s get_post_meta() function, used in the above example, in this WordPress Wednesday post, or from the WordPress Codex. The important bit to note in this example is the last parameter value, ‘false’, is for the optional $single parameter. From the Codex:

$single (boolean) (optional) If set to true then the function will return a single result, as a string. If false, or not set, then the function returns an array of the custom fields….

Because we are gathering an array of information — different practice area page IDs — we want to store this information in an array. If the information you’re grabbing is better used as a string, then change this value to ‘true’.

Obviously, using PHP to query WordPress posts in the Custom Field Templates can go well beyond pairing lawyers to practice groups on law firm websites. I’ve only started scraping the surface of what’s possible myself; if you can see a use for this kind of functionality in your own project, please share in the comments below!

In the next WordPress Wednesday, we’re going to cover what I think is the final reason that makes this plugin (and the WordPress custom field functionality on the whole) so useful: querying by custom field value.

WordPress Wednesday: An Introduction to the Custom Field Template Plugin

Geek Factor: 3

In this week’s WordPress Wednesday, I’m going to write about a plugin I can’t believe I haven’t covered yet: the Custom Field Template plugin by Hiroaki Miyashita.

The Custom Field Template plugin is one I’ve used on every site I’ve developed since discovering it. It takes WordPress’s Custom Field functionality (which I wrote a quick introduction to on the Greenhouse over a year ago), and basically adds a user-friendly interface to it.

Out of the box, the WordPress custom fields are a bit awkward; users have to manually add them to each post, and the values are only tracked in text fields. For users who are comfortable using WordPress, this is doable, though annoying and a bit convoluted; for those less comfortable, it can be extremely confusing.

The Custom Field Template allows you to create a ‘form’ out of the different custom fields you’d like to display on posts. Each of these forms group the different values together; you can also restrict a form template to only show for a specific post type (post, page or a custom type), a specific template, or even specific posts by ID.

One item I frequently use custom fields for is creating profiles on websites – for example, the profiles on the Stem website each have custom fields behind the scenes to help manage the data about each Stemployee and make customizing displays possible.

Here is the data for my profile, using the out-of-the-box custom fields:

custom-fields

Not too bad, actually. But what if a new profile was needed for the site? This is what the custom fields would look like in that case:

custom-field-dropdown

WordPress does save keys that have been used before for custom fields, which is great… as long as you have an idea what each of them does. It is functional, but hardly self-explanatory — I’d feel fine managing data like this myself, but would feel awful handing it over to someone else without detailed instructions. At this time, months after setting up those various custom fields, I can’t even remember what half of them are used for.

Enter the Custom Field Templates

Now here are the exact same custom fields, using the Custom Field Template plugin:

custom-field-template

The Custom Field Template uses its own simple shortcodes to create form fields for custom field data — here is a shot of the Custom Field Template UI to give you an idea of what it looks like:

custom-field-template-example

The Custom Field Templates can be set to use simple text inputs, like above; it’s also possible to use checkboxes:

… select dropdowns:

… and even use WordPress’ WYSIWYG editor:

Here is a quick example of the Custom Field Template plugin in action on Stem’s Lawblogs.ca directory. I’ve created a fake entry for the Greenhouse blog, and entered the details into the fields that were created (complete with several questionable Clawbies wins):

customfield-lawblogs-example

The output is then generated using the get_post_meta() function (more about that in this WordPress Wednesday post about custom fields):

custom-field-lawblogs-output

If you’re feeling adventurous, you can also incorporate PHP code into the Custom Field Template — unfortunately, this feature doesn’t have a lot of documentation, but if you know a bit of PHP it can be worth fiddling around with as you can add some handy automation. In my opinion, this is what really pushes this plugin from ‘helpful’ to ‘invaluable’ — I’ll be covering some examples of PHP we’ve paired with this plugin in the weeks to come.

Do you have a plugin that you can’t build websites without? Please share in the comments below!

The Google Movie

Confession: after reading Douglas Coupland’s excellent novel Microserfs, I made a pilgrimage with some friends to Seattle (well, Redmond, more specifically) to visit the Microsoft campus. Laurel was one of my fellow pilgrims and captured our adventures for posterity.

I’m far from a Microsoft devotee, but being there, in the place where so much household name software was developed, seemed extremely culturally significant.

So, I was totally fascinated to hear that the Googleplex will soon be seen on the silver screen in a forthcoming movie called “The Internship“. Barry Schwartz of Search Engine Land sums up the plots like this: “The movie is about two older men who know nothing about computers who recently lose their jobs. They decide to try to get a job at Google by interning there first.” While some of the filming was done on a pseudo-Google set in Atlanta, they also filmed at the Googleplex in Mountain View, California.

Unfortunately, IMHO, the trailer is  not even close to funny, so I don’t have high hopes for this film. But just as I eventually caved and watched “The Social Network”, I’m sure it’s only a matter of time before I succumb to my curiosity about the inner workings – albeit imagined ones – of Google. Are you excited for “The Internship”?

Cursive Catastrophe

I totally identified with Mary Ellen Bates’ thoughts on whether handwriting has become obsolete. She relays that children aren’t required to learn cursive in school anymore; instead, they now learn to type. Yikes! Although I learned to write in cursive when I was young, I admit I have never had nice handwriting. Like Mary Ellen,

“…my penmanship is so bad that I print my handwritten notes, and my signature looks like the scrawl of a third grader. But I still swoon when I see nice handwriting and dream of one day having the time to practice my cursive writing. Yes, I’m a nerd.”

In fact, it’s not just my cursive that looks ridiculous, it’s any writing I do on paper. While I used to journal by hand and write letters to friends, these days those have been replaced by blogging and emails. I am a semi-decent typist, but I physically write so rarely nowadays that it’s no wonder my handwriting is so atrocious. When I do sit down to physically write for any length of time, my hand gets tired embarrassingly quickly.

And I’ll admit my spelling skills have taken a giant hit, too. As a child, I was a good enough speller to make it into the city-wide spelling bee, but today, WordPress has alerted me to three misspellings in this post alone. Let’s pretend they were all typos, though ;)

At one of the law firms I used to work at, there was an articling student (who went on to become an associate) who freely and frequently sent hand-written thank-you notes to anyone who’d done something nice for him. There were people who teased him (lightheartedly, for the most part), but hey, I still remember the guy because of this, almost a decade later. Cursive or not, hand-written notes are rare these days — rarer still in law firms — and it was such a small, but thoughtful action; a tangible, personal expression of gratitude and connection. It’s always nice to receive a thank-you note, but hand-written ones really stand out.

What is lost when we stop writing on paper and committing spelling rules to heart, and start focusing entirely on a screen, typing skills, and built-in dictionaries? It doesn’t bode well. According to the WSJ article that Bates cites,

“Typing doesn’t help the brain develop as much as writing in longhand, a tactile means of expression with roots in scratching on cave walls, argues handwriting analyst Michelle Dresbold. With typing, the fingers make repetitive movements rather than connect shapes, she said.

“It’s a very natural process to take a crayon or a rock and make symbols with your hand,” Ms. Dresbold said. “It’s just bringing down things from your brain.” Without that, “children are not thinking as thoroughly.”"

The only way to reclaim these skills is to practice. Maybe I’ll dig out a paper journal and practice my cursive tonight.