【问题标题】:Wordpress NavigationWordPress 导航
【发布时间】:2009-11-20 00:10:56
【问题描述】:
我正在开发一个 Wordpress 主题,我需要处理导航,我在创建它时遇到了一些麻烦。
我正在寻找的导航如下所示:www.neu.edu/humanities。
我已经走到这一步了:
if (is_front_page()) {
wp_list_pages('title_li=&exclude=12&depth=1');
}
else {
// display the subpages of the current page while
// display all of the main pages and all of the
// and display the parent pages while on the subpages
}
【问题讨论】:
标签:
php
wordpress
navigation
wordpress-theming
【解决方案1】:
<?php
if (is_front_page()) {
wp_list_pages('title_li=&exclude12&depth=1');
}
else {
$output = wp_list_pages('echo=0&depth=1&title_li=&exclude=12');
if (is_page()) {
$page = $post-ID;
if ($post->post_parent) {
$page = $post->post_parent;
}
$children = wp_list_pages('echo=0&child_of='.$page.'&title_li=&exclude=12');
if ($children) {
$output = wp_list_pages('echo=0&child_of='.$page.'&title_li=&exclude=12');
}
}
echo $output;
}
?>