Klniu博客维护记录
目录 |
1 2012
1.1 wp_supercache修復
--Klniu(留言) 2012年5月9日 (三) 16:43 (CST)
主機目錄更改了,wp_supercache就不能用了,要修復wp-content/advanced_cache.php中的路徑才行。
1.2 添加meta description
--Klniu(留言) 2012年5月9日 (三) 15:56 (CST)
在header.php中添加以下語句,以顯示meta description:
<?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <meta name="description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" /> <?php endwhile; endif; elseif(is_home() || is_front_page()) : { ?> <meta name="description" content="<?php bloginfo('description'). " " . the_author_meta( "description", 2); ?>" /> <?php } elseif (is_category()) : { ?> <meta name="description" content="<?php echo category_description(); ?>"/> <?php } endif; ?>
參見:http://www.kohactive.com/blog/wordpres-hacks-using-post-excerpts-as-meta-descriptions/
1.3 更改至子域名并301
--Klniu(留言) 2012年5月9日 (三) 10:58 (CST)
把blog的域名從klniu.com轉到blog.klniu.com中,同時更新.htaccess
1.4 新建archive.php和category.php頁面
--Klniu(留言) 2012年5月8日 (二) 17:04 (CST)
Dillon主題沒有archive.php和category.php頁面,因此,在index.php中忽略有些分類時,這些頁面也不會顯示,添加這些文件。
1.5 隱藏日記分類
--Klniu(留言) 2012年5月8日 (二) 16:29 (CST)
不在首頁顯示日記分類下的文章,把它們單獨放到一個分類裏,參考文章:http://www.zreading.cn/archives/467.html,修改index.php,:
<?php if (have_posts()) : query_posts($query_string .'&cat=-244');?>
244是日記的分類id.
1.6 page頁面添加分類
--Klniu(留言) 2012年5月8日 (二) 15:20 (CST)
修正Dillon主題頁面沒有評論,因此造成留言板功能失效的問題。修改page.php這一部分:
<?php while (have_posts()) : the_post(); ?> <div class="post"> <h2> <?php the_title(); ?> </h2> <?php the_content(); ?> <?php get_template_part( 'content', 'page' ); ?> <?php comments_template( '', true ); ?> <div class="clear"></div> </div><!-- end post --> <?php endwhile; ?>
1.7 添加頁碼
--Klniu(留言) 2012年5月8日 (二) 14:46 (CST)
Dillon主題添加分頁,參考文章:http://sofree.cc/wp-nav/
修改的文件有functions.php, index.php, search.php
1.8 修改Google cse 以適應新主題
--Klniu(留言) 2012年5月8日 (二) 14:46 (CST)
修改Google cse 以適應新主題,刪除Google Custom search 插件。
1.9 添加favicon圖標
--Klniu(留言) 2012年5月6日 (日) 18:01 (CST)
博客添加favicon圖標,在header.php下添加以下語句:
<link rel="shortcut icon" href="<?php bloginfo( 'template_url' ); ?>/images/favicon.ico" />
2 2011
Klniu 2011年8月12日 (五) 15:56 (CST)
添加Google+按钮,在主题footer.php的
<?php wp_footer(); ?>
下面添加:
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
{lang: 'zh-CN'}
</script>
在content-single.php的
<h1 class="entry-title"><?php the_title(); ?></h1>
上面添加:
<g:plusone></g:plusone>