If I can’t find your business online, it may as well not exist

As an early 30-something, I find myself caught between generations and the labels and expectations that go along with them. I resent the mostly condescending and unflattering characteristics that usually appear in profiles of Millennials, but in one regard I’m sure I am actually very typical: I use the internet for (almost) everything. And I’m constantly being reminded that older generations might not use the internet in the same way or to the same extent that my contemporaries and I do.

I was recently preparing for a cottage getaway with my extended family, and realized we needed a particular piece of camping gear. One Baby Boomer relative suggested I make some calls to various stores around town. “Forget that,” I laughed to myself, and fired up the iPad to check the inventory availability on a couple local big box stores’ websites/apps. There was one store (ahem, Target) that doesn’t have an ecommerce site, and the time it took to call the store, wait for someone to check the shelf, and report back to me was longer than it took for me to review products, prices, and availability at four others online.

Bottom line: I love it when companies make it easy for me to find answers to my questions. And the critical starting point for “easy” is “online.”

In my experience, older generations sometimes don’t fully grasp that for people my age and younger, if we can’t find you online, you may as well not exist.

My colleague Jordan Furlong came up with the perfect analogy on this topic in a recent post on his Law21 blog. Here’s his response to the question, How can a law firm encourage its workers to adapt to the online environment? It applies to basically any organization, not just law firms.

“Everyone now searches for everything on the internet. Vast numbers of people buy vast quantities of products and services on the internet. Having a weak or non-existent internet presence is like moving your law office out of a prime commercial office building in a major city and into an unmarked house on the outskirts of a small town. It’s really no more complicated than that.”

Even if I know a product or a business exists, I do research online to find out more about it, to confirm my first impression, to find reviews and sales, etc. When I can’t find any info online, I get suspicious, or become unimpressed, or lose interest — and move on. Okay, there’s that Millennial desire for instant gratification!

But Millennials are also known for their relentless optimism, and maybe this is why I so enthusiastically believe that every organization can have a great online presence.

The barriers to being online have never been lower, so there is zero reason your business or organization shouldn’t be active online. If you work in a business, investing in your website can’t be optional. There don’t need to be a lot of bells and whistles; your time and effort in developing good content matter much more.

If money truly is an obstacle (maybe you’re a student or run a charity), get a free blog at WordPress or Blogspot. (Facebook and Twitter are great, but please don’t make them your only presence!)

Whatever you do, if you want me to find you, don’t let me come up empty-handed when I look for you online. Because I’ll always look.

Replacing Reader, Part 3: We Have a Winner!

This is the final post in a series on my experiences in replacing Google Reader. The first two installments are available here: Part 1 & Part 2.

I’ve now been using The Old Reader for a few weeks, and I think I’ve found a winner.

The Old Reader

Here’s what I like:

  • Imported feeds are retained in their folders, meaning minimal set-up time to get things the way I like them (the folder order wasn’t preserved, but it didn’t take long for me to reorder them)
  • I can drag & drop feeds between folders to organize
  • I can choose to mark as read by scrolling over or by clicking on an item title
  • I can choose to show only unread items within a feed
  • I can choose to show only folders with unread items
  • Unsubscribing from a feed is super-simple – there’s an unsubscribe button right on each feed’s homepage, and only one more click is required to confirm. I have to admit, I always found it a bit annoying to have to use the feed settings drop-down menu in Google Reader; this is so much simpler.
  •  I LOVE having the option to toggle back and forth between read/unread status on an individual item within a feed. This is a feature that used to exist in Google Reader – why they got rid of it, I’ll never know.
  • Bonus: A panel on the Home screen shows you any dead feeds in your collection, allowing me to quickly identify and remove defunct feeds

So far, the only downside I can see is that the system can be a tiny bit slow. Initially, I was concerned about the “you can only sign in with Google or Facebook” thing, but they’ve since implemented a separate login system, and setting up an account is very simple.

I learned my lesson with Google Reader: you get what you pay for, and I don’t want it to happen again. I’ll gladly pay an annual subscription for The Old Reader, and I really hope they’ll come up with a PayPal-based billing solution ASAP. These guys deserve it.

Only time will tell whether The Old Reader makes it. I sure am rooting for them, though. I’ve still been using Google Reader occasionally as I transition entirely to The Old Reader, and the other day I noticed some glitchiness there that made me wondering if Google isn’t already letting things slide.

There’s been some debate over the last couple years on whether RSS is becoming defunct in the face of social media and especially Twitter. The swift and passionate reaction, though, from Google Reader’s power users proved to me that this technology isn’t going anyway. Long live RSS!

Have you settled on a replacement for Google Reader? Or maybe you were using something else all along? I’d love to hear your thoughts and experiences.

Replacing Reader, Part 2: Too Much to Ask?

This is part 2 in a series of posts on my experiences in replacing Google Reader. Read the first installment here.

That first week after Google announced they were killing Reader, I read blog posts and articles galore on how much Reader’s so-called “power users” would miss it. I experimented with various replacements being mentioned as frontrunners (Feedly, Netvibes), but none of them did a good enough job at what I wanted. I was beginning to think I’d have to settle.

My needs were pretty simple:

  • I wanted something browser-based. I only have two devices, a desktop and an iPad, but I read feeds from both, and when I travel, I sometimes use my husband’s laptop or another family member’s computer to work from. I need my feeds to be synchronized across all of these devices and on whatever browser I like. An app would be nice, but not critical for my own particular needs.
  • I wanted something simple. I rarely share anything to social networks directly from other websites, so the ability to send items directly to Facebook, Twitter, G+, etc., is not a selling point for me. I am used to – and happy with – scanning text-only headlines, so a “magazine-style”, image-heavy app like Flipboard holds little appeal for me (and besides which, I think it’s only available for mobile devices).
  • I wanted something fast but efficient. I didn’t want the reader to be running in the background and making my browser sluggish as it updated.
  • I wanted to be able to have a reasonable degree of control over how my feeds are grouped and ordered.

One last key point: I was more than willing to pay for something that met my needs. Over the years I have become a lot more aware of the fact that content and service creators deserve to be paid for their products, and then there’s also the idea that “if you’re not paying, you’re the product”.  These days, it seems like free is becoming more risky and more disappointing.

I sat on the issue for a few weeks. Delaying the inevitable, I suppose.

I had heard Fever mentioned as a good replacement, but I knew you needed a server to install it on. I may be an RSS power user, but I’ll be honest, I get a little uncomfortable around words like server and c-panel. (That’s what I have smart colleagues, friends, and family members for!) So I assumed Fever was not an option for me. But then Laurel mentioned she’d installed it on the server for her own domain and invited me to test it out. Since I also own a couple domains, she thought if I liked it, we could install it on one of those servers and my problems would be solved.

So, with great expectations, I logged into Laurel’s test Fever account and started poking around. My first impression was that it was very promising, but after a few days of trying it out, I reluctantly admitted to myself I wouldn’t be happy with it.  I just didn’t like the interface. I’m a creature of habit, I guess. I started to wonder if maybe I was asking too much. Was I becoming stubborn and unwilling to adapt? I didn’t think so, but it was beginning to look that way. I decided to give myself some more time to think on it.

After abandoning my quest for a couple of weeks, I was ready to give it another go. I thought maybe I’d give The Old Reader a try. A friend of mine had mentioned that it took a week for her feeds to import… yikes… but since Google Reader would still be around for another couple of months, I had the time.

With bated breath, I signed in, using my Google account. I don’t like being made to log in that way, but I decided to get over that [they’ve since added a separate login system, anyway]. I followed the instructions to import my subscriptions and thought, okay, I’ll come back in a week. Only… all 200 had imported within about 5 minutes! Score! This was looking good…

Check back next week for the final installment in this series.

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.


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:

[php] '5', 'category_name'=>'news' )); // preface each step in the WordPress Loop // with the variable that holds the new WP_Query if ($myCustomQuery->have_posts()) : while ($myCustomQuery-> have_posts()) : $myCustomQuery->the_post(); ?>


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’:

[php] $myQuery = new WP_Query('meta_key=lunch'); [/php]

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:

[php] $myQuery = new WP_Query('meta_value=sandwich'); [/php]

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:

[php] $myQuery = new WP_Query(array( 'meta_key' => 'lunch', 'meta_value' => 'sandwich' )); [/php]

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:

[php] $args = array( 'post_type' => 'post', 'meta_query' => array( array( 'key' => 'lunch', 'value' => 'sandwich', 'compare' => 'NOT LIKE' ) ) ); $myQuery = new WP_Query($args); [/php]

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:

[php] $args = array( 'post_type' => 'post', 'meta_query' => array( array( 'key' => 'lunch', 'value' => 'sandwich' ), array( 'key' => 'total', 'value' => array(1,10); 'compare' => 'BETWEEN' ) ) ); $myQuery = new WP_Query($args); [/php]

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:


ID // each lawyer profile that has a 'Practice Area' value // matching that ID will be returned $practiceMembers = new WP_Query(array( 'post_type' => 'page', 'numberposts' => -1, 'meta_query' => array( array( 'key' => 'Practice Areas', 'value' => $post->ID )), 'orderby' => 'menu_order', 'order' => 'ASC' )); // if there are practice group members // display them with links in an unordered list if ($practiceMembers->have_posts()) : ?>

Practice Group Members

    have_posts()) : $practiceMembers->the_post(); ?>

The output for this code would look a little like:


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:

[html] [Clawbies Year] type = checkbox values = 2006 # 2007 # 2008 # 2009 # 2010 # 2011 # 2012 # 2013 [/html]

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:


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:

[html] [Clawbies Year] type = checkbox code = 0 [/html]

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.

[php] //query to get practice area pages $posts = get_posts(array( 'post_type' => 'page', 'post_parent' => 123, //update to match the Practice Area parent page ID 'numberposts' => -1, // grabs all of the subpages 'orderby' => 'menu_order', 'order' => 'ASC')); // foreach loop to store the practice area information // in the arrays used by the Custom Field Template foreach($posts as $post) { $values[] = $post->ID; $valueLabels[] = $post->post_title; } [/php]

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:


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:

[html] [Practice Areas] type = checkbox code = 1 [/html]

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


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:


ID, "Practice Areas", false); // check if the $practiceArea variable has any content if($practiceAreas) { ?>

Practice Groups

    $practiceAreas,'posts_per_page'=>'-1','post_type'=>'page','orderby' => 'menu_order','order' => 'ASC')) : // if not an array, use 'p' for a single post ID $practiceAreasQuery = new WP_Query(array('p'=>$practiceAreas,'posts_per_page'=>'-1','post_type'=>'page')); // with the $practiceAreasQuery results, run a Loop while ($practiceAreasQuery->have_posts()) : $practiceAreasQuery->the_post(); ?>

Visually, the output would look something like the following:


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.

Legal FAQ Collections