Home › Forums › Backend Issues (wp-admin) › Fields relations – post edit page › Reply To: Fields relations – post edit page
This is my JSON fields export :
[
{
"key": "group_5aa5895baf14e",
"title": "Galerie",
"fields": [
{
"key": "field_5aa58afaead97",
"label": "Images",
"name": "images",
"type": "gallery",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"min": "",
"max": "",
"insert": "append",
"library": "uploadedTo",
"min_width": "",
"min_height": "",
"min_size": "",
"max_width": "",
"max_height": "",
"max_size": "",
"mime_types": "jpg,jpeg"
},
{
"key": "field_5aa58c6d1857a",
"label": "Nombre de tirages",
"name": "nbr_tirages",
"type": "number",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"min": "",
"max": "",
"step": ""
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "projets"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": ""
},
{
"key": "group_5aa58c0355671",
"title": "Image",
"fields": [
{
"key": "field_5aa58dde15eb3",
"label": "Numéro de tirage",
"name": "no_tirage",
"type": "number",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"min": "",
"max": "",
"step": ""
}
],
"location": [
[
{
"param": "attachment",
"operator": "==",
"value": "image\/jpeg"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": ""
}
]
And my function.php custom post type code :
/* CUSTOM POST TYPE */
function wpm_custom_post_type() {
$labels = array(
'name' => _x( 'Projet', 'Post Type General Name'),
'singular_name' => _x( 'Projets', 'Post Type Singular Name'),
'menu_name' => __( 'Projets'),
'all_items' => __( 'Tous les projets'),
'view_item' => __( 'Voir les projets'),
'add_new_item' => __( 'Ajouter un nouveau projet'),
'add_new' => __( 'Ajouter'),
'edit_item' => __( 'Editer le projet'),
'update_item' => __( 'Modifier le projet'),
'search_items' => __( 'Rechercher un projet'),
'not_found' => __( 'Non trouvé'),
'not_found_in_trash' => __( 'Non trouvé dans la corbeille'),
);
$args = array(
'label' => __( 'Projets'),
'description' => __( ''),
'labels' => $labels,
//'register_meta_box_cb' => 'bar',
//'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
'hierarchical' => false,
'public' => true,
'has_archive' => true,
'rewrite' => array( 'slug' => 'projets'),
);
register_post_type( 'projets', $args );
}
add_action( 'init', 'wpm_custom_post_type', 0 );
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.