【问题标题】:Is it navigation style possible in WordPress?WordPress中是否可以使用导航样式?
【发布时间】:2012-03-20 08:21:19
【问题描述】:

任何人都可以告诉我双导航样式是否容易实现或不可能。我接触的一位 WordPress 开发人员告诉我不是。

基本上,我们希望通过网页顶部的链接(附图中的椅子)进行导航,同时在页面左侧引入子导航(附件中的垂直标签)。

因此,如果您在 HOME 部分,您将在左侧有 3 个选项卡,将 HOME 分解为 3 个子部分。如果您单击另一个顶部链接并转到 XYZ 部分,则左侧的选项卡会有所不同,以提供 XYZ 的子部分。

我知道这显然可以从 HTML 的角度来完成,但那家伙说这是不可能的,同时,在 WordPress 中保持内容可编辑为页面等。

我希望所有主页及其子内容都可以通过 WordPress CMS 进行编辑。

可能吗?谢谢

【问题讨论】:

    标签: wordpress content-management-system navigation structure


    【解决方案1】:

    您可以创建 2 个自定义菜单标题和侧边栏。对于标题菜单的每个子项,给出不同的类。现在基于活动页面 ID 使用 jQuery 启用子菜单类来显示它。

    【讨论】:

      【解决方案2】:

      您的顶部菜单可以是没有任何其他链接(没有下拉菜单或子链接)的标准 wordpress 菜单,然后查询并获取您所在当前页面的所有直接子级,并将这些页面显示为链接。您可以在侧边栏中使用此代码,并将其包含在所有具有侧边导航的模板页面中。

      <?php $args = array(
      'child_of' => $post->ID, //get all children of current page
      'sort_order' => 'ASC',
      'sort_column' => 'post_title',
      'parent' => $post->ID,  //get all children that have a parent of the current page.  This will return only the children pages not grandchildren.
      'post_type' => 'page',
      'post_status' => 'publish'
      );
      
      $sub_pages = get_pages( $args ); 
      //then loop through the $sub_pages array and display the links as needed
      ?> 
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-08-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-01-01
        • 2010-09-27
        • 1970-01-01
        相关资源
        最近更新 更多