3
一
一
自由控制wordpress页面输出的ID
有时,如果你的页面过多的话,也许会撑破主题导致不美观,也许有些页面你不想让它出现里导航栏里。我们只要加一句简单的判断语法即可解决这个问题。
在主题header.php中寻找php wp_list_pages,你会看到exclude字样,这个就是关键。如果你想隐藏ID为10,20的页面,那么只要在它后面加上=10,20即可。即exclude=10,20(注意其中的逗号是英文状态下字符)。
举例:
<?php wp_list_pages(”depth=1&exclude=$artsee_exclude_page;&title_li=”); ?>
应写成
<?php wp_list_pages(”depth=1&exclude=$artsee_exclude_page=10,20;&title_li=”); ?>
<?php wp_list_pages(’title_li=&depth=2&sort_column=menu_order’); ?>
应写成
<?php wp_list_pages(’title_li=&depth=2&sort_column=menu_order&exclude=10‘); ?>
肯定是行的吖