Wordpress二级菜单子页

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wordpress二级菜单子页相关的知识,希望对你有一定的参考价值。

This is what I wanted: I had a structure like this: -Artist --Peter Miller ---Pictures ---Press ---Videos and wanted to have the sub-sub-Menu when located on the "Peter Miller"-Page. So that on "Peter Miller" you'd have "Pictures, Press and Videos"-Menu and also on the sibling pages but not on Artists-Page!
  1. <?php
  2. global $wp_query;
  3. if( empty($wp_query->post->post_parent) )
  4. {
  5. $parent = $wp_query->post->ID;
  6. }
  7. else
  8. {
  9. $parent = $wp_query->post->post_parent;
  10. } ?>
  11.  
  12. <?php if(wp_list_pages("title_li=&child_of=$parent&echo=0" )): ?>
  13. <ul class="submenus">
  14. <?php wp_list_pages("title_li=&child_of=$parent" ); ?>
  15. </ul>
  16.  
  17. <?php endif; ?>

以上是关于Wordpress二级菜单子页的主要内容,如果未能解决你的问题,请参考以下文章

WordPress用JavaScript和CSS实现二级菜单展开手风琴效果

PHP Wordpress二级菜单子页面

在Wordpress中打开父页/子页时显示子页

列出Wordpress子页

Wordpress-检查子页是否属于父页

WordPress父页和子页摘录