admin管理员组文章数量:1336340
I am trying to use the Atreas Theme: /
This is the site I am working on: /
All I want is an archive page for my Team Members to display them all in one spot.
I tried adding:
'has_archive' => true'
to the plugin php files directly "cpost-team.php" but I can't for the life of me find the url for the archive page for Team Members. Either that or I'm missing something else. This is the direct code for this "Custom Posts" (aka Team Members) plugin:
<?php
//Define team post type
add_action( 'init', 'cpo_cpost_team' );
function cpo_cpost_team() {
$show_ui = false;
if ( defined( 'CPOTHEME_USE_TEAM' ) || cpo_get_option( 'display_team' ) ) {
$show_ui = true;
}
$labels = array(
'name' => __( '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' => '<input type="checkbox" />',
'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 );
}
}
Also based on the code what should the url outcome be? I assumed it should be on: /
Additionally my custom taxonomy for team members (groups) is not displaying posts that fall under the given group: /?cpo_team_category=ba
Sorry I'm not great with php. Thank you in advance!!
I am trying to use the Atreas Theme: https://wordpress/themes/antreas/
This is the site I am working on: https://sandbox.paediatricphysiotherapyassociates/
All I want is an archive page for my Team Members to display them all in one spot.
I tried adding:
'has_archive' => true'
to the plugin php files directly "cpost-team.php" but I can't for the life of me find the url for the archive page for Team Members. Either that or I'm missing something else. This is the direct code for this "Custom Posts" (aka Team Members) plugin:
<?php
//Define team post type
add_action( 'init', 'cpo_cpost_team' );
function cpo_cpost_team() {
$show_ui = false;
if ( defined( 'CPOTHEME_USE_TEAM' ) || cpo_get_option( 'display_team' ) ) {
$show_ui = true;
}
$labels = array(
'name' => __( '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' => '<input type="checkbox" />',
'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 );
}
}
Also based on the code what should the url outcome be? I assumed it should be on: https://sandbox.paediatricphysiotherapyassociates/cpo_team/
Additionally my custom taxonomy for team members (groups) is not displaying posts that fall under the given group: https://sandbox.paediatricphysiotherapyassociates/?cpo_team_category=ba
Sorry I'm not great with php. Thank you in advance!!
Share Improve this question asked May 30, 2020 at 22:08 Lauren BonsellLauren Bonsell 11 Answer
Reset to default 0A generous soul helped me from a different community. Turns out it was a very simple fix:
Still looking for help for the custom taxonomy for team members (groups) is not displaying posts that fall under the given group: https://sandbox.paediatricphysiotherapyassociates/?cpo_team_category=ba
本文标签: Custom Post TypeTaxonomy not displaying archive
版权声明:本文标题:Custom Post TypeTaxonomy not displaying archive 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742385424a2464935.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论