好久没有折腾Wordpress了,晚上趁着睡不着,更换下主题并做些修改,为了以后方便修改和查找,在此记录下。
第一、修改inove导航菜单同时显示页面和分类
1、给主题设置里添加一个选项:show all(意思就是同时显示页面和分类)。
1)修改inove/functions.php在第220行找到:
<label>
<input name="menu_type" type=”radio” value=”categories” <?phpif($options['menu_type'] == ‘categories’) echo "checked=’checked’"; ?> />
<?php _e(‘Show categories as menu.’, ‘inove’); ?>
</label>
2)在下面添加:
<label>
<input name="menu_type" type=”radio” value=”pages_and_categories” <?phpif($options['menu_type'] == ‘pages_and_categories’) echo"checked=’checked’"; ?> />
<?php _e(‘Show All.’, ‘inove’); ?>
</label>
2、实现ShowAll功能:
1)修改inove/templates/header.php在第30行找到:
<?php if($options['menu_type'] == ‘categories’){wp_list_categories(‘title_li=0&orderby=name&show_count=0′);}
else {wp_list_pages(‘title_li=0&sort_column=menu_order’);}
?>
2)将上面的代码替换为:
<?php
if($options['menu_type'] == ‘categories’ || $options['menu_type'] ==’pages_and_categories’){wp_list_categories(‘title_li=0&orderby=name&show_count=0′);}
if($options['menu_type'] == ‘pages’ || $options['menu_type'] ==’pages_and_categories’){wp_list_pages(‘title_li=0&sort_column=menu_order’);}
?>
上面显示顺序是先分类再页面,如果你喜欢把页面放在分类前面那就把上面的代码换成:
<?php
if($options['menu_type'] == ‘pages’ || $options['menu_type'] ==’pages_and_categories’){wp_list_pages(‘title_li=0&sort_column=menu_order’);}
if($options['menu_type'] == ‘categories’ || $options['menu_type'] ==’pages_and_categories’){wp_list_categories(‘title_li=0&orderby=name&show_count=0′);}
?>
做完以上工作,进入后台>>外观>>当前主题选项>>选择 show all >>保存,刷新一下,就能看到导航栏同时显示分类和页面了。
注意:请将代码里面的全角双引号改成半角
第二,添加Google Analytics分析,不使用其他的统计功能了。
直接在后台==》主题==》当前主题选项,把“将分析代码添加到网站中”选项打勾然后保存即可。
暂时就这么多,SEO方面的修改明天继续….先睡觉去鸟。