__('Latest / page %s', 'cfpt'),
'search' => __('Search results for %s', 'cfpt'),
'tag' => __('Tag archives for %s', 'cfpt'),
'category' => __('Category archives for %s', 'cfpt'),
'author' => __('Author archives for %s'),
'date' => __('Archives for %s', 'cfpt')
));
$vars = array(
'paged' => get_query_var('paged'),
'cat' => get_query_var('cat'),
'tag' => get_query_var('tag_id'),
's' => get_query_var('s'),
'year' => get_query_var('year'),
'm' => get_query_var('m'),
'monthnum' => get_query_var('monthnum'),
'day' => get_query_var('day'),
'author' => get_query_var('author_name')
);
// Keep things kosher
$vars = array_map('esc_html', $vars);
extract($vars);
$output = '';
if (is_front_page() && is_paged()) {
$output = sprintf($messages['home_paged'], $paged);
}
else if(!empty($s)) {
$output = sprintf($messages['search'], $s);
} else if(!empty($tag)) {
$output = sprintf($messages['tag'], single_tag_title('', false));
} else if(!empty($cat)) {
$output = sprintf($messages['category'], single_cat_title('', false));
} else if(!empty($author)) {
$user = get_user_by('login', $author);
if (is_object($user)) {
$output = sprintf($messages['author'], esc_html($user->display_name));
}
} else if(is_archive() && !empty($year)) {
$date = '';
if(!empty($monthnum)) {
$date .= $wp_locale->get_month($monthnum);
if(!empty($day)) {
$date .= ' ' . $day;
}
$date .= ', ';
}
$date .= $year;
$output = sprintf($messages['date'], $date);
}
// If we've hit a page that has a title, output it.
if($output) {
return $output;
}
}
function cfpt_page_title($before = '', $after = '') {
if ($title = cfpt_get_page_title()) {
echo $before . $title . $after;
}
}
?>