php Sage 9 ACF自定义帖子类型和选项页面
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Sage 9 ACF自定义帖子类型和选项页面相关的知识,希望对你有一定的参考价值。
<?php
namespace App;
// clients
add_action( 'init', function () {
$labels = array(
"name" => __( 'Clients', '' ),
"all_items" => __( 'Clients', '' ),
"singular_name" => __( 'Client', '' ),
"add_new" => __( 'Add client', '' ),
"add_new_item" => __( 'Add client', '' ),
);
$args = array(
"label" => __( 'Clients', '' ),
"labels" => $labels,
"description" => "Client post type",
"supports" => array( "title", "revisions", "thumbnail", "editor" ),
"public" => true,
"show_ui" => true,
"show_in_rest" => true,
"rest_base" => "",
"has_archive" => false,
"show_in_menu" => true,
"menu_icon" => 'dashicons-groups',
"exclude_from_search" => true,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
);
// rename to collaboration
register_post_type( "client", $args );
});
// Register Facilities
$args = array(
'hierarchical' => true,
'has_archive' => false,
'labels' => array(
"name" => __( 'Facilities', '' ),
"singular_name" => __( 'Facility', '' ),
"add_new" => __( 'Add Facility', '' ),
"add_new_item" => __( 'Add Facility', '' ),
),
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'facilities' ),
);
register_taxonomy( 'facilities', array( 'sites' ), $args );
if (function_exists('acf_add_options_page')) {
$site_title = get_bloginfo();
acf_add_options_page(array(
'page_title' => $site_title . ' theme settings',
'menu_title' => 'Theme Settings',
'menu_slug' => 'theme-general-settings',
'capability' => 'manage_options',
'redirect' => false,
'position' => 20,
));
}
以上是关于php Sage 9 ACF自定义帖子类型和选项页面的主要内容,如果未能解决你的问题,请参考以下文章
Wordpress ACF 字段如何从自定义帖子类型中获取选项
php ACF Pro |使用自定义帖子类型标记
php 将ACF字段添加到自定义帖子类型的管理列
php 通过acf选择字段查询类别中的自定义帖子类型
php 通过acf选择字段查询类别中的自定义帖子类型
使用自定义帖子类型的标题列表作为 ACF 字段的值