WordCamp New York City 2009

WordCampNYC - Nov 14-15 Soon after the swissmiss AIGA talk in Milwaukee (November 6th) I’m going to hit WordCamp NYC (November 14-15). Hope to see you there!

Meetup: jQuery Overview

jQuery

Have you seen animations on sites without the use of flash? Have you noticed calendars widgets, drag n’ drop features, fading elements and all sorts of dynamic things happening on websites these days? Have you heard of AJAX and want to know what it is and why it’s such a big deal?

jQuery is a JavaScript library that lets you do all sorts of great things with your websites. Google, Dell, NBC, and WordPress are just a few companies that use jQuery to spice things up. jQuery is one of the tools that helps web applications respond more quickly to user input and mimic some of the user-friendly features of desktop applications.

This presentation will go into some technical details but, don’t worry, background information and examples will help put the pieces together. If you’re not a developer, you’ll leave with a deeper understanding of how websites work. If you code, then you’ll have another tool to add to your arsenal.

What: jQuery Overview
When: September, 16 2009 7:00pm 8:30pm
Where: Greensboro Public Library Downtown (take a right as soon as you walk in and head to the end of the hall)
RSVP & Details: Triad Web Meetup

These events are always free and everyone is welcome so please spread the word!

Programmatically Pull Attachments from WordPress Posts

One of my favorite tricks in using WordPress as a CMS is to have it handle photo resizing and insertion into pages automatically. For example, swissmiss and I just launched Convert (a NYC based Green Roof Service) today. Within the projects section they display photos of the green roofing projects they’ve done and let you download a project sheet PDF.

It would be quite a burden for the client to have to know how to create all of the appropriate image sizes, upload the photos and insert the correct HTML tags. So here’s what we’ve done instead:

First, we set the WordPress image sizes to match the thumbnail and large sizes that we needed by going to Settings->Media in the admin tool.

Next, the client just has to upload all of their photos and a PDF for the project sheet. The images are automatically scaled by WordPress and attached to the page. They can also change the order the photos appear by dragging/dropping them in the admin tool.

Finally, adding this simple snippet of code to the functions.php in their theme, I can ask for all of the images associated with the post.

// get all of the images attached to the current post
function aldenta_get_images($size = 'thumbnail') {
	global $post;
	
	$photos = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
	
	$results = array();

	if ($photos) {
		foreach ($photos as $photo) {
			// get the correct image html for the selected size
			$results[] = wp_get_attachment_image($photo->ID, $size);
		}
	}

	return $results;
}

So, if you want all of the thumbnail images (as an array of html tags) you can make the default call:

$photos = aldenta_get_images();

If you want all of the medium sized images you pass medium as the size:

$photos = aldenta_get_images('medium');

My function has a bit more going on inside of it but you get the idea of what you can do with this. Another way I like to use it is to pull the first image from the post. Sometimes, you want to display a thumbnail image that represents a post. Here’s how I like to do that:

// get the first image attached to the current post
function aldenta_get_post_image($size = 'thumbnail') {
	global $post;

	$photos = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
	
	if ($photos) {
		$photo = array_shift($photos);
		return wp_get_attachment_image($photo->ID, $size);
	}
	
	return false;
}

// the html tag for the first image or false if no image is found
$photo = aldenta_get_post_image();

What if you want to get the PDF attached to the post? No problem – it works the same but you change the mime type to application/pdf.

// get the first PDF attached to the current post
function aldenta_get_post_pdf() {
	global $post;

	$attachments = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'application/pdf', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
	
	if ($attachments) { 
		$attachment = array_shift($attachments);
		return wp_get_attachment_url($attachment->ID);
	}
	
	return false;
}

// the url to the first pdf or false if no pdf is found
$pdf = aldenta_get_post_pdf();

This technique has helped me tremendously and I hope it does the same for you.

Happy Earth Day!

play station shirt

As you can see, I’m sporting one of my favorite shirts today.

Since I’m a geek, and have fun electronics, I try to keep everything turned off and unplugged when not in use. The laptop gets powered down at night and the power strip switched off where all of the electronics are plugged in. Actually, in support of Earth Day I think I should keep everything turned off and skip work…

What do you do to help out the Earth?

Meetup: Intro to WordPress

This meetup I’ll be covering how to install WordPress from scratch, getting started with creating/modifying a WordPress theme, the basics of the admin and show some examples of what can be done with WordPress as a CMS.

Bring your questions and any WordPress sites that you’d like to show the group. All skill levels should be able to take away something from the presentation.

What: Intro to WordPress
When: April, 22 2009 7:00pm 8:30pm
Where: Greensboro Public Library Downtown (take a right as soon as you walk in and head to the end of the hall)
RSVP: Triad Web Meetup

These events are always free and everyone is welcome so please spread the word!

Stop Mailing Me Phone Books

With Google’s local search, and sites like YellowPages.com, I haven’t opened a phone book in years. The printed books are such a waste of resources and time. I also get the same book delivered to my home and work addresses.

I contacted YellowPages.com via email and they were nice enough to give me a list of local providers who are responsible for phone books. So, I called Bell South, my local book provider, and removed both of my addresses from their mailing list.

  • AMERITECH: 1-800-346-4377
  • BELL ATLANTIC/VERIZON: 1-800-346-9639
  • BELL SOUTH: 1-800-682-4000
  • GTE: 1-800-346-9639
  • MCI: 1-800-444-3333
  • PAC BELL: 1-800-848-8000
  • SWBELL: 1-800-792-2665

Get rid of these monstrous books and help save a tree (and fuel, paper waste, water, forest animals, money and everything else that’s connected to producing a phone book)!

Happy 25th Birthday Macintosh!

Apple Macintosh
Marcin Wichary

iWork.com – Google Docs Competition?

I love the free apps that Google provides (especially the incredible spam-blocking e-mail), but I’m really excited to see Apple’s iWork go web-based. It currently appears that you can only “share” documents online and not edit them, but I imagine that’s the next step. The documents look exactly the same in the application or in their beautiful web interface and notes can be added by reviewers. Can’t wait to see where this one goes.

iwork.com

Recent Work: abitareshop.com phase 2

abitare

Phase 2 of a beautiful project I’ve been working on with Tina (swissmiss) went live last month. Now abitare has a full online checkout! The site is built on WordPress with a shop plugin used to manage products and a completely custom front-end theme and checkout process that hooks into authorize.net to accept credit card payments.

It’s the perfect place to order holiday gifts!

Recent Work: lawyeravenue.com

Lawyer Avenue

I had the pleasure of working with the fantastic designers at Design Commission out of Seattle to build an e-commerce/blog/content site for their client Lawyer Avenue. The site went live last month and is a custom blend of WordPress and Magento.