/* * This function outputs post title and * links it either to posts's permalink * (default WordPress behavior) or to * external link supplied in custom field * that should have any of the following names: * url1, title_url, url_title. The value of * the custom key should be the target URL. * Example: 'url1' = 'http://www.istudioweb.com/' * * (C) 2008 by Vlad Grubman, www.istudioweb.com * */ function print_post_title() { global $post; $thePostID = $post->ID; $post_id = get_post($thePostID); $title = $post_id->post_title; $perm = $post_id->guid; $post_keys = array(); $post_val = array(); $post_keys = get_post_custom_keys($thePostID); if (!empty($post_keys)) { foreach ($post_keys as $pkey) { if ($pkey=='url1' || $pkey=='title_url' || $pkey=='url_title') { $post_val = get_post_custom_values($pkey); } } if (empty($post_val)) { $link = $perm; } else { $link = $post_val[0]; } } else { $link = $perm; } echo '

'.$title.'

'; }