From 3b59a429d3428638550e49fc8d2fc9e1afa67bbf Mon Sep 17 00:00:00 2001 From: Gabe B-W Date: Sat, 4 Jul 2009 06:47:28 +0000 Subject: [PATCH] Adding template tags. :P --- fk-template-tags.php | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/fk-template-tags.php b/fk-template-tags.php index f9f95a2..9f11058 100644 --- a/fk-template-tags.php +++ b/fk-template-tags.php @@ -21,6 +21,48 @@ function the_character_appearances(){ echo ''; } +/** + * Prints the actor who plays a character given by $character_id. Defaults to current post. + * @param $character_id The post id of the character. + */ +function the_actor($character_id = 0){ + echo get_the_actor($character_id); +} + +/** + * Prints a link to the post with the actor who plays a character given by $character_id. Defaults to current post. + * @param $character_id The post id of the character. + */ +function the_actor_link($character_id = 0){ + echo get_the_actor_link($character_id); +} + +function get_the_actor_link($character_id = 0){ + global $post; + if( $character_id === 0 ){ + $character_id = get_the_ID(); + } + $actor_id = fk_character_get_actor($character_id); + $actor = get_the_title($actor_id); + return sprintf('%s', + get_permalink($actor_id), $actor); +} + +/** + * Gets the actor who plays a character given by $character_id. Does not print. Defaults to current post. + * @param $character_id The post id of the character. + */ +function get_the_actor($character_id = 0){ + global $post; + if( $character_id === 0 ){ + $character_id = get_the_ID(); + } + $actor_id = fk_character_get_actor($character_id); + $actor = get_the_title($actor_id); + return $actor; +} + + /**** EPISODE TAGS ****/ /** * Prints the season and episode number @@ -38,7 +80,7 @@ function the_season_ep_num(){ */ function the_episode_characters(){ $characters = fk_episode_get_characters(get_the_ID()); - echo 'The following characters appear in this episode
'; + echo 'The following characters appear in this episode:
'; echo '