退房一般的template.php。两个函数wp_get_archives和get_archives_link。您必须破解wp_get_archives才能更改在$ text中加载的内容。帖子数被加载到放置在get_archives_link链接之外的$ after变量中。取而代之的是:
$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
if ($show_post_count)
$after = ' ('.$arcresult->posts.')' . $afterafter;
是这样的:
$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
if ($show_post_count)
$text= $text.' <small>'.$arcresult->posts.'</small>';
这还只是每月存档。您必须对每年,每周和每日块进行修改。
编辑:排除来自链接的标题<small>
元件最简单方法是加载它在每个块中一个单独的变量,然后将其通入经修饰的get_archives_link。在上面的例子中,右后$文本被载入了刚刚加载值到$标题:
$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
$title = $text;
if ($show_post_count)
$text= $text.' <small>'.$arcresult->posts.'</small>';
$output .= get_archives_link($url, $text, $format, $before, $after, $title);
然后修改get_archives_link:
function get_archives_link($url, $text, $format = 'html', $before = '', $after = '', $title = '') {
$text = wptexturize($text);
if($title == '')
$title = $text;
$title_text = esc_attr($title);
$url = esc_url($url);
if ('link' == $format)
$link_html = "\t<link rel='archives' title='$title_text' href='$url' />\n";
elseif ('option' == $format)
$link_html = "\t<option value='$url'>$before $text $after</option>\n";
elseif ('html' == $format)
$link_html = "\t<li>$before<a href='$url' title='$title_text'>$text</a>$after</li>\n";
else // custom
$link_html = "\t$before<a href='$url' title='$title_text'>$text</a>$after\n";
$link_html = apply_filters("get_archives_link", $link_html);
return $link_html;
}
优秀的东西安德鲁,运作良好。然而,我只有一个问题。 标签在标题属性中包含标签。换句话说,如果我把光标放在(链接)上,我不仅会得到相关信息,比如2011年2月 - 6篇文章,还有标签会让事情变得糟糕:“2011年2月 - 6篇文章'。如何删除的title =“”属性中提及的标签? – Sotkra 2011-02-17 04:04:40