【问题标题】:Show subcategories only for selected category page in wordpress仅在 wordpress 中显示所选类别页面的子类别
【发布时间】:2015-06-23 04:48:16
【问题描述】:

是否可以仅显示正在查看的类别页面的子类别。我有很多类别,它们都有自己的子类别,但我不想在主页上显示它们。我只想在侧边栏中显示该类别页面的子类别。有可能吗?

请推荐

【问题讨论】:

    标签: wordpress


    【解决方案1】:

    试试这个:

    $parent_term_id = 4 // term id of parent term
    
    $taxonomies = array( 
        'category',
    );
    
    $args = array(
        'parent'         => $parent_term_id,
        // 'child_of'      => $parent_term_id, 
    ); 
    
    $terms = get_terms($taxonomies, $args);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-02
      • 2014-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-13
      • 2012-06-25
      相关资源
      最近更新 更多