0℃
0℃
0℃
2010年09月30日
⁄ 其它
后台编辑 主题 的 functions.php , 输入以下代码
function colorCloud($text) {
$text = preg_replace_callback('|<a (.+?)>|i', 'colorCloudCallback', $text);
return $text;
}
function colorCloudCallback($matches) {
$text = $matches[1];
$color = dechex(rand(0,16777215));
$pattern = '/style=('|")(.*)('|")/i';
$text = preg_replace($pattern, "style="color:#{$color};$2;"", $text);
return "<a $text>";
}
add_filter('wp_tag_cloud', 'colorCloud', 1);
可以看到,颜色是随机的,可...
wordpress阅读全文
0℃
2010年09月02日
⁄ 其它
1、创建页面模板,选择主题中的index.php文件,并将文件名改为fenye_theme.php;
2、打开fenye_theme.php,有代码最顶部加如下代码(模板名称,更改后,此模板将出现在模板选择的下拉菜单中);
<?php
/*
Template Name: fenye_theme
*/
?>
3、些一分类的内容加到该模板中,查找如下代码:
<?php if (have_posts()) : ?>
在此段代码之上加上:
<?php
$limit = get_option('posts_per_page');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('cat=1&showposts='...
wordpress阅读全文