rendered paste body<?php/** * Plugin Name: Teaser Image * Plugin URI: http://www.headzoo.com * Version: 1.0 * Description: Teaser image for posts * Author: Sean Hickey * Author URI: http://www.headzoo.com */add_action('the_teaser_image', 'tsr_theImage', 10, 2);function tsr_theImage($defaultImage = null, $id = null) { global $post, $wpdb; if ($id) { $postID = $id; } else { $postID = $post->ID; } $image = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE post_parent = $postID AND post_title LIKE '%tsr-%' LIMIT 1"); if (empty($image)) { if (empty($defaultImage)) { return; } $image = $defaultImage; } $permalink = get_permalink($postID); echo "<a href=\"$permalink\" title=\"$post->post_title\" class=\"teaser-link\"><img src=\"$image\" alt=\"$post->post_title\" class=\"teaser-img\" /></a>";}?>