我正在制作一个包含所有成员的网页。因此,到目前为止,我使用以下代码创建了一个自定义帖子类型:
function midas_team_post() {
register_post_type( \'midas-team\',
array(
\'labels\' => array(
\'name\' => \'تیم میداس\',
\'singular_name\' => \'تیم میداس\',
\'add_new\' => \'افزودن ورزشکار\',
\'add_new_item\' => \'افزودن ورزشکار\',
\'edit_item\' => \'ویرایش ورزشکار\',
),
\'rewrite\' => array ( \'slug\' => __( \'members\' ) ) ,
\'public\' => true,
\'has_archive\' => false,
\'show_ui\' => true,
\'menu_icon\' => \'dashicons-groups\',
\'supports\' => array( \'title\', \'thumbnail\' )
)
);
}
add_action( \'init\', \'midas_team_post\' );
我已经为它创建了一个模板文件,称为single midas team。php和其中的所有帖子都有如下URL:http://localhost/members/{posts}
.因此,我想创建此自定义帖子类型下的选项页(让我们称之为all members),我试图找出如何为“all members”选项页创建不同的模板文件,URL如下所示:http://localhost/members/all/
我使用此代码为自定义帖子类型添加选项页:
if( function_exists(\'acf_add_options_page\') ) {
acf_add_options_sub_page(array(
\'page_title\' => \'تمام اعضا\',
\'menu_title\' => \'تمام اعضا\',
\'parent_slug\' => \'edit.php?post_type=midas-team\',
\'menu_slug\' => \'all\',
));
}
*我也在使用ACF Pro。