of posts so that others using * the plugin can easily extract author information. */ function inject_author_meta(): void { global $post; if ( ! $post || ! is_singular() ) { return; } $author_ids = [ $post->post_author ]; if ( function_exists( 'get_coauthors' ) ) { $coauthor_ids = array_map( function( $coauthor ) { return $coauthor->ID; }, get_coauthors( $post->ID ) ); $author_ids = array_merge( $author_ids, $coauthor_ids ); } $authors = get_users( [ 'include' => $author_ids, ] ); foreach ( $authors as $author ) { if ( $author->first_name && $author->last_name ) { $parsed = $author->first_name . '|' . $author->last_name; ?> post_content ); $bib_index = array_search( 'abt/bibliography', array_column( $blocks, 'blockName' ), true ); if ( is_int( $bib_index ) ) { add_json_script( 'abt-bibliography-json', $blocks[ $bib_index ]['innerHTML'] ); } } } add_action( 'the_post', __NAMESPACE__ . '\collect_bibliography' ); /** * Enqueues frontend CSS and JS. */ function enqueue_scripts(): void { global $post; if ( is_singular() ) { $base_handle = has_blocks( $post ) ? 'frontend' : 'frontend-legacy'; wp_enqueue_style( get_handle( $base_handle, 'style' ) ); wp_enqueue_script( get_handle( $base_handle, 'script' ) ); } else { wp_enqueue_style( get_handle( 'frontend', 'style' ) ); } } add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_scripts' );