iNove主题后台添加同时显示页面与文章分类的选项:
1、修改inove文件夹下functions.php文件
<label> <input name="menu_type" type="radio" value="categories" <?php if($options['menu_type'] == 'categories') echo "checked='checked'"; ?> /> <?php _e('Show categories as menu.', 'inove'); ?> </label>
在其下方加入以下代码:
<!--同时显示页面和分类_Start--> <label> <input name="menu_type" type="radio" value="pages_and_categories" <?php if($options['menu_type'] == 'pages_and_categories') echo "checked='checked'"; ?> /> <?php _e('将页面和分类均作为菜单', 'inove'); ?> </label> <!--同时显示页面和分类_End-->
2、修改inove/templates/header.php文件
将以下代码注释掉:
<?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'); } ?>
替换为以下代码:
<?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');} ?>
如果想把分类放在页面前面,则上面替换为以下代码:
<?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');} ?>