fix: latest version
This commit is contained in:
@@ -47,7 +47,7 @@ function cascapedia_st_jules_register_acf(): void {
|
||||
acf_add_local_field_group([
|
||||
'key' => 'group_document_fields',
|
||||
'title' => 'Document',
|
||||
'fields' => [ csj_file('field_document_file', 'document_file', 'PDF'), csj_text('field_document_group', 'document_group', 'Groupe'), csj_date('field_document_date', 'document_date', 'Date') ],
|
||||
'fields' => [ csj_file('field_document_file', 'document_file', 'PDF'), csj_date('field_document_date', 'document_date', 'Date') ],
|
||||
'location' => [[['param' => 'post_type', 'operator' => '==', 'value' => 'document']]],
|
||||
]);
|
||||
acf_add_local_field_group([
|
||||
|
||||
@@ -26,4 +26,18 @@ function cascapedia_st_jules_register_content_types(): void {
|
||||
'rewrite' => ['slug' => str_replace( '_', '-', $slug )],
|
||||
] );
|
||||
}
|
||||
|
||||
register_taxonomy( 'document_category', ['document'], [
|
||||
'labels' => [
|
||||
'name' => 'Catégories de documents',
|
||||
'singular_name' => 'Catégorie de document',
|
||||
'add_new_item' => 'Ajouter une catégorie de document',
|
||||
'edit_item' => 'Modifier la catégorie de document',
|
||||
],
|
||||
'hierarchical' => true,
|
||||
'public' => true,
|
||||
'show_admin_column' => true,
|
||||
'show_in_rest' => true,
|
||||
'rewrite' => ['slug' => 'documents/categorie'],
|
||||
] );
|
||||
}
|
||||
|
||||
@@ -67,7 +67,8 @@ function cascapedia_st_jules_get_documents(): array {
|
||||
]);
|
||||
$groups = [];
|
||||
foreach ( $posts as $post ) {
|
||||
$group = get_post_meta( $post->ID, 'document_group', true ) ?: __( 'Documents', 'cascapedia-st-jules' );
|
||||
$terms = get_the_terms( $post, 'document_category' );
|
||||
$group = ( ! is_wp_error( $terms ) && ! empty( $terms ) ) ? $terms[0]->name : __( 'Documents', 'cascapedia-st-jules' );
|
||||
$file_id = (int) get_post_meta( $post->ID, 'document_file', true );
|
||||
$href = $file_id ? wp_get_attachment_url( $file_id ) : '';
|
||||
if ( ! $href ) {
|
||||
|
||||
Reference in New Issue
Block a user