fix: latest version

This commit is contained in:
2026-05-19 11:33:13 -04:00
parent a8c016d7b1
commit 1d5bb8bd90
5 changed files with 27 additions and 34 deletions

View File

@@ -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 ) {