WordPress 导航

发布于 2024-08-11 08:38:13 字数 461 浏览 0 评论 0原文

我正在开发一个 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
}

I am working on a Wordpress Theme, I need to work on the navigation, I am having a little trouble creating it.

The navigation I am looking for looks like this: www.neu.edu/humanities.

I have gotten this far:

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
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烙印 2024-08-18 08:38:13
<?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;
    }
?>
<?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;
    }
?>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文