#masthead { background: url('/images/header_1.jpg'); } */ function headimage() { global $posts,$post_meta_cache; // Define style name $headerstyle = "#masthead"; // Define style image directory (no trailing slash) $imagedir = "/images"; // Get the first post on a page $post = $posts[0]; // Get the keys and values of the custom fields: $id = $post->ID; $imagevals = $post_meta_cache[$id]['head_image']; // Generate the tags if (count($imagevals)) { foreach ($imagevals as $headimage) { $tag = ""; print "$tag\n"; } } } // Hook into the Plugin API add_action('wp_head', 'headimage'); ?>