Preventing unwanted Google Search Results

Something weird and peculiar happened to me this week which I thought I’d like to share with you so that you learn from my mistake.

A client alerted me to the fact that my name was showing up as an author on their site in Google search results and sent me the following screenshot.

Google-search-results

This website was built for a company that required no blog, thus no author template was provided. But ever so helpful Google decided to index the author archive anyway, meaning that clicking on the link, led to a page with no content.

When building websites for clients, I normally insert the content in all the pages and thus I’m listed as the author, which is where this information on the search results page comes from. This is fairly normal and I’m sure that I’m the author of millions of pages out there.

There are a few ways to deal with this.

  1. When launching the site, if you are adding your client as a user, simply switch all of the authorship on all content.
  2. If you won’t be adding your client as a user, you can go to your User profile and change your display name. A good idea would be to add the company’s name as a nickname and then use that as your display name.
  3. Finally and this is probably the most important tip, if you are using the Yoast SEO plugin, go to Titles & Meta > Archives setting and se the author archive to no index and Disable the author archives.  This will then redirect anyone who hits that link to your home page.

Ideally, you want to do this before you launch a site, before Google indexes your non-existing author archive, but I didn’t know it would do this until this week. Lesson learned.

 

 

The High Cost of Low Cost Themes

One of the reasons why people love WordPress so much is because there are so many resources, such as thousands of themes to chose from. Unfortunately, just like everything else, the quality of all of these themes can’t be guaranteed.

I was recently asked by two clients to help them out with their new websites. Both were almost ready to launch, but weren’t happy with a few things in their WordPress admin.

The first client, hired a developer and was a bit shocked to hear that they wouldn’t be able to update WordPress ever, or any of their plugins. The developer they hired, purchased a theme that was no longer supported and broke if anything was updated. Not only does this open you up to security vulnerability, it’s also just shoddy work. This is the equivalent of me buying my friend a new laptop running a XP them being stuck with using IE8 forever. I’m not sure my friend would appreciate.

In the second instance, the client also hired a developer who purchased a commercial theme but the updates weren’t an issue. However, they had no idea how the admin worked. The entire WordPress admin had been transformed and even I, after a few hours, didn’t know what was what. In addition, the final site loaded 32 javascript files and 17 external stylesheet, so was running super slow.

In both of these cases, I spent a few hours poking around the theme and tried to figure out what was going on. But I gave up very fast. Both contained so many files, it was hard to understand what was needed and what was not. In the end, I simply re-built the themes from scratch. Both were happy with the way the site displayed on and functioned on the front end, they just wanted to have an easier back end to manage.

In my opinion both of these commercial themes displayed what I resent most from them:

They have too many options.
Theme vendors want their theme to satisfy a large pool of clients, thus the more features there are, the better. These options come at a price though. More options, means more complexity with increase in error, and more files to load which makes your site load slowly.

Many love to customize the WordPress admin.
Perhaps this is meant to be helpful, but it’s not. As soon as you modify an interface, you’re asking your audience to relearn how things are set up. People shouldn’t have to re-learn out the WordPress admin works when switching from theme to theme.

So how do you know which theme you should use?
That’s a great question.

You might think to yourself that free themes won’t be as good, but the quality of themes in the WordPress.org repo has improved greatly over the years. In addition many theme foundries release their themes for free on WordPress.org and then offer a pro version for a fee. Before purchasing these, I would encourage anyone to look at a few free versions first.

If a theme from a foundry caught your eye, the first thing I would recommend before buying it, is to look at the theme’s rating and look at how the developer is addressing support issues. Are questions in the support form answered well and in a timely manner? Have many people written great reviews or are all of them one star only?

Make sure that the theme you are purchasing contains 99% of what your looking for. If all you want to do is change one or two colours, that’s easy enough to do with some custom CSS or a child theme, but if you want to make major changes to the layout, then you might as well start from scratch or look at free themes. Keep in mind as well, that purchasing a theme may not save you all that much. Hiring a good developer who builds theme from scratch will  be able to give you a bespoke theme made just right for you.

 

 

Taming Content with Advanced Custom Fields

Has you may know already, I’m a big fan of the Advanced Custom Fields (ACF) plugin. I’ve used it to build carousels, call to action boxes, additional content such as sub-titles, extra featured images,  etc.. When building custom themes for clients it’s important to ensure that updates and adding new content will be as easy as possible. Thus the reason I favour ACF to create meta boxes rather than shortcodes.

In my opinion shortcodes aren’t intuitive, and although as developers were used to seeing brackets and tags, clients may not “see” that a shortcode isn’t closed properly. Meta boxes on the other hand don’t require clients to add tags, brackets or code of any kind.

Not only is the ACF plugin well maintained it also has great documentation and this just got better. Today I discovered another great resource all about using ACF on your website. This free PDF resource written by Steve Grunwell takes a look at the plugin, walks you through some practical examples of building carousels, alternate page headlines, and more, and then discusses the future of the plugin with the upcoming ACF 5 release.

I would encourage you to check it out. Even if you’ve been using ACF for a while, Steve has some great code snippets to share.

 

Handy image plugins to keep you sane.

I’ve been meaning to write a post about a few handy plugins that I use all the time. Some of these have saved me tons of time and effort.

My favourite one, and I’m sure lots of developers will agree, is Regenerate thumbnails. While working a theme, if you decide to change an image size of aspect ratio, this plugin will simply go through all of the images in your media library and resize them at once. Fantastic tool.

A new one I discovered a few months ago via twitter, is Imsanity. This tool is brilliant and makes so much sense. I’ve had clients upload 8MB images in the pass and these just end up clogging up the server. This plugin automatically resizes huge uploads to a decent more reasonable large size.

I’ve been a huge fan of the image widget plugin for a very long time. I’m not sure if there’s a better one out there, but this one does exactly what it says, very simply and elegantly. I love it.

Finally, this new plugin, hilariously called My Eyes are Up Here allows you to control how thumbnails are cropped based on face control. I haven’t had the chance to play with it much, but it looks like a great plugin and the authors are stellar developers. I’m guessing this one will soon be everyone’s favourite.

What image plugin have you found awesome? Care to share?

Why bother with WordCamps?

I had a great time at WordCamp Vancouver this weekend. I had the privilege of hearing great talks, had great conversations and learned a few things. At the end of the day, someone who I just met, asked me a very interesting question. “What do I get out of attending WordCamps?”

I had to think about it for a few seconds. My first reaction to that question was, does he mean financially and does attending help my business? He then proceed to clarify that yes, that’s what he meant, but then also said, has it improved me as a developer to which the answer is YES.

I think that the big thing for me is that WordCamps, do NOT generate leads and thus I don’t consider them as big networking events where lots of business deals are made. However, it does get be motivated to learn and research more about the topics I discovered that day/weekend and in turn, makes me a better developer which then generates “better” business for me.

This weekend was no different and I was encouraged by his question to make a list of the all the things I need to go and learn more about. I thought I would share it would you. So here goes:

  1. Review Mandi Wise’s extensive list of resources
  2. Make sure to watch Mel’s presentation about making your own custom widget when it is published on WordPress TV, because I just couldn’t be in two rooms at once
  3. Look into WP CLI. I’ve known about this long enough… Enough with the procrastination already.
  4. Play with Flexbox and Picture fill… again, stop procrastinating
  5. Make a fully accessible theme and add it to the repo

That list isn’t too long, but some of these items may take me a while… What about you, what do you get out of WordCamps?

See you at WordCamp Vancouver 2014

WordCamp Vancouver is just around the corner and if you do any kind of development work with WordPress, you should join us. This year’s WordCamp is the developer edition and the schedule has something for everyone. WordCamp is held on July 26 at the BCIT campus downtown Vancouver. Tickets are on sale and going fast, so make sure you grab yours soon.

I’ll be doing a lightning talk on handling multiple screens and responsive design using CSS and mobble. If you’ve never used the plugin you should come by and ask your questions. If you have any right now, feel free to leave a comment and I’ll do my best to answer you right away or I’ll chat to you at the conference. See you there.

How to add a caption to featured images

Featured images are awesome and if you’ve ever wanted to add an image above the title of your post, using a feature images is the way to go.

When adding images in your posts or pages, adding a caption is easy, but if you’ve tried to do the same with featured images, then you’re out of luck. This is problematic if you want to use images from the Creative Commons where a photo credit is requested.

Faced with this problem this morning I did a quick google search and found the following answer on Stack Overflow.

Easy peasy once this snippet of code is added to your functions.php

function the_post_thumbnail_caption() {
  global $post;

  $thumbnail_id    = get_post_thumbnail_id($post->ID);
  $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));

  if ($thumbnail_image && isset($thumbnail_image[0])) {
    echo '<p class="caption">'.$thumbnail_image[0]->post_excerpt.'</p>';
  }
}

Then use the following in your single.php.

<?php if ( has_post_thumbnail() ) : 
  the_post_thumbnail( 'feature' );
  the_post_thumbnail_caption();
endif; ?>

And Voila!

Easier conditionals with mobble

A few weeks ago, I was working on a site that had the busiest footer. The footer design made sense on a large screen, but I couldn’t wrap my head around how to make it look great on tablets and phones. I was looking for a way to extend beyond media queries and apply a different design per platform, not just breakpoints. That’s when I discovered mobble.

Mobble is a handy WordPress plugin that provides conditional functions for detecting a variety of mobile devices and tablets.

Once installed, mobble allows you to add conditional statement to your theme templates such as:

<?php 
if ( is_mobile() ) {
  get_template_part( 'foot-mobile' );
} elseif ( is_tablet() ) {
  get_template_part( 'foot-tablet' );
} else {
  get_template_part( 'foot-desktop' );
}
?>

Now all I had to do was create different templates for each type of footer. This is so much better than having to fight with media queries.

Some of you will undoubtedly say, that you don’t need a plugin for that. But if your PHP knowledge is limited like mine, this plugin is fantastic!

UPDATE: As noted below in Alex’s comment, if you are using Jetpack, you can also use it’s built in function and target specific devices.

Get your tickets to WordCamp Vancouver

wc-vancouver-2013-logoWordCamp organizers, Joey, Jill and Flynn are super excited to announce that WordCamp Vancouver is back for another edition and that tickets are now on sale. WordCamp Vancouver 2013 will be on Saturday August 17th, at the BCIT Downtown Campus.

Tickets are only $20 and the venue is fabulous, so there’s no excuse. If you’ve ever wanted to attend WordCamp, this is it. The final list of speakers will be announced next week. This conference is the perfect opportunity for developers to come and mingle with others as well as brand new bloggers/website manager/marketers/website owners and non developers who want to ask questions and learn something new.

Hope to see you there!

Become a Better Developer by Contributing to WordPress

I owe much of my career to WordPress and it’s use of use. However, none of it would have been possible without the community. Contributing to WordPress is a great way to become better with WordPress as a developer, designer, teacher, writer… there are contributing opportunities for everyone.

During my talk at WordCamp Ottawa I’ll be sharing info on how you can get started.

In the meantime, here are my slides for the presentation: