首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自定义Post类型/分类法不显示存档

自定义Post类型/分类法不显示存档
EN

WordPress Development用户
提问于 2020-05-30 22:08:24
回答 1查看 38关注 0票数 0

我正在尝试使用Atreas主题:https://wordpress.org/themes/antreas/

这是我正在工作的网站:https://sandbox.paediatricphysiotherapyassociates.com/

我想要的只是一个存档页面,供我的团队成员在一个地方显示。我试着将:'has_archive' => true'直接添加到plugin文件“cpost-工作组. php”,但在我的一生中,我无法为团队成员找到存档页面的url。要么是那样要么是我错过了别的东西。这是这个“自定义帖子”(又名团队成员)插件的直接代码:

代码语言:javascript
复制
 __( 'Team Members', 'cpo-companion' ),
       'singular_name'      => __( 'Team Member', 'cpo-companion' ),
       'add_new'            => __( 'Add Team Member', 'cpo-companion' ),
       'add_new_item'       => __( 'Add New Team Member', 'cpo-companion' ),
       'edit_item'          => __( 'Edit Team Member', 'cpo-companion' ),
       'new_item'           => __( 'New Team Member', 'cpo-companion' ),
       'view_item'          => __( 'View Team Member', 'cpo-companion' ),
       'search_items'       => __( 'Search Team Members', 'cpo-companion' ),
       'not_found'          => __( 'No team members found.', 'cpo-companion' ),
       'not_found_in_trash' => __( 'No team members found in the trash.', 'cpo-companion' ),
       'parent_item_colon'  => '',
   );

   $member_slug = cpo_get_option( 'slug_team_member' );
   if ( '' == $member_slug ) {
       $member_slug = 'cpo_team';
   }

   $fields = array(
       'labels'              => $labels,
       'public'              => true,
       'publicly_queryable'  => true,
       'exclude_from_search' => true,
       'show_ui'             => $show_ui,
       'query_var'           => true,
       'rewrite'             => array( 'slug' => apply_filters( 'cpotheme_slug_team_member', $member_slug ) ),
       'capability_type'     => 'page',
       'hierarchical'        => false,
       'menu_icon'           => 'dashicons-universal-access',
       'menu_position'       => null,
       'supports'            => array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes' ),
   );

   register_post_type( 'cpo_team', $fields );

}


//Define admin columns in team post type
add_filter( 'manage_edit-cpo_team_columns', 'cpo_cpost_team_columns' );
if ( ! function_exists( 'cpo_cpost_team_columns' ) ) {
   function cpo_cpost_team_columns( $columns ) {
       $columns = array(
           'cb'             => '',
           'ctct-image'     => __( 'Image', 'cpo-companion' ),
           'title'          => __( 'Title', 'cpo-companion' ),
           'ctct-team-cats' => __( 'Groups', 'cpo-companion' ),
           'date'           => __( 'Date', 'cpo-companion' ),
           'author'         => __( 'Author', 'cpo-companion' ),
       );
       return $columns;
   }
}

//Define team category taxonomy
add_action( 'init', 'cpo_tax_teamcategory' );
if ( ! function_exists( 'cpo_tax_teamcategory' ) ) {
   function cpo_tax_teamcategory() {
       $labels = array(
           'name'               => __( 'Member Groups', 'cpo-companion' ),
           'singular_name'      => __( 'Member Group', 'cpo-companion' ),
           'add_new'            => __( 'New Member Group', 'cpo-companion' ),
           'add_new_item'       => __( 'Add Member Group', 'cpo-companion' ),
           'edit_item'          => __( 'Edit Member Group', 'cpo-companion' ),
           'new_item'           => __( 'New Member Group', 'cpo-companion' ),
           'view_item'          => __( 'View Member Group', 'cpo-companion' ),
           'search_items'       => __( 'Search Member Groups', 'cpo-companion' ),
           'not_found'          => __( 'No member groups were found.', 'cpo-companion' ),
           'not_found_in_trash' => __( 'No member groups were found in the trash.', 'cpo-companion' ),
           'parent_item_colon'  => '',
       );

       $slug = cpo_get_option( 'slug_team_category' );
       if ( '' == $slug ) {
           $slug = 'team-group';
       }
       $fields = array(
           'labels'            => $labels,
           'public'            => true,
           'show_ui'           => true,
           'show_in_nav_menus' => true,
           'show_tagcloud'     => false,
           'rewrite'           => array( 'slug' => apply_filters( 'cpotheme_slug_team_category', $slug ) ),
           'hierarchical'      => true,
       );

       register_taxonomy( 'cpo_team_category', 'cpo_team', $fields );
   }
}

同样,基于代码,url的结果应该是什么?我以为应该是开着的:https://sandbox.paediatricphysiotherapyassociates.com/cpo_小组/

此外,我对团队成员(组)的自定义分类没有显示属于给定组:https://sandbox.paediatricphysiotherapyassociates.com/?cpo_团队_category=ba的帖子。

对不起,我对php不太在行。提前谢谢你!!

EN

回答 1

WordPress Development用户

发布于 2020-05-31 17:56:21

一个慷慨的灵魂帮助了我来自不同的社区。事实证明,这是一个非常简单的解决办法:

寻找团队成员(组)自定义分类的帮助的Still不显示属于给定组: https://sandbox.paediatricphysiotherapyassociates.com/?cpo_团队_category=ba的帖子

票数 0
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/367954

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档