如何在WordPress中仅显示子子页面的子页面?

所以, 我有一个这样的页面结构

    Location
    - New York
      - Restaurant #1
        - Dinner Menu
        - Lunch Menu
      - Restaurant #2
        - Dinner Menu
        - Lunch Menu

因此, 当我说”餐厅1″页面时, 我希望它仅显示”餐厅1″的所有子页面。不幸的是, 我当前的代码库改为返回纽约的所有子页面。

这是我的代码:

if ( is_page() ) {
   if($post->post_parent)
       $children = wp_list_pages('sort_column=menu_order&title_li=&child_of='.$post->post_parent.'&echo=0');
   else
       $children = wp_list_pages('sort_column=menu_order&title_li=&child_of='.$post->ID.'&echo=0');

   if ($children) {
       echo $children; 
   }

}

#1


得到它的工作。就是这样:

<? $pages = get_pages('child_of='.$post->ID.'&sort_column=post_title'); 
$count = 0; 
foreach($pages as $page){ ?>
  <li>
    <a href="<? echo get_page_link($page->ID) ?>"><? echo$page->post_title?></a>
  </li>
<? } 
?>

来源:

https://www.srcmini02.com/66581.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37058.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?