最近奋斗博客换成了WordPress 默认主题 Twenty Eleven 。Twenty Eleven 的最大优点就是加载速度快,而且兼容性很好。
但Twenty Eleven文章页面不支持侧边栏,我们需要手动为WordPress 默认主题 Twenty Eleven 添加侧边栏。
步骤如下:
1.打开single.php,在末尾找到<?php get_footer(); ?>,在其前一行添加<?php get_sidebar(); ?>,保存。(修改single.php可以在单篇日志页面添加侧边栏,同样可以在其他页面添加)
2.打开functions.php,在末尾找到
function twentyeleven_body_classes( $classes ) { if ( ! is_multi_author() ) { $classes[] = ‘single-author’; } if ( is_singular() && ! is_home() && ! is_page_template( ‘showcase.php’ ) && ! is_page_template( ‘sidebar-page.php’ ) ) $classes[] = ‘singular’; return $classes; } add_filter( ‘body_class’, ‘twentyeleven_body_classes’ );
将其直接注释掉
/** * function twentyeleven_body_classes( $classes ) { * * if ( ! is_multi_author() ) { * $classes[] = ‘single-author’; * } * * if ( is_singular() && ! is_home() && ! is_page_template( ‘showcase.php’ ) && ! is_page_template( ‘sidebar-page.php’ ) ) * $classes[] = ‘singular’; * * return $classes; *} * *add_filter( ‘body_class’, ‘twentyeleven_body_classes’ ); */
保存刷新页面,再按照自己需要的样式来修改就可以了。