Try replacing that with this:
<?php
/* translators: used between list items, there is a space after the comma */
$categories_list = my_get_the_category_list( __( ' ', 'requiredfoundation' ) );
if ( $categories_list ):
?>
<?php printf( __( ' %2$s', 'requiredfoundation' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
?>
<?php endif; // End if categories ?>
And put this in your theme’s functions.php:
function my_get_the_category_list( $separator = ' ') {
$output = '';
$categories = get_the_category();
if ( $categories ) {
foreach( $categories as $category ) {
$itemprop = '';
// use category ID of parents 'book' and 'author'
if( ( $category->parent == 3 ) || ( $category->parent == 4 ) ){
$itemprop = ($category->parent == 3) ? ' itemprop="book"' : ' itemprop="author"';
}
$output .= '<a href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s", 'requiredfoundation' ), $category->name ) ) . '" ' . $itemprop .'>'.$category->cat_name.'</a>'.$separator;
}
return trim( $output, $separator );
}
}
And change the category IDs to that of the book and the author category IDs in:
// use category ID of parents 'book' and 'author'
if( ( $category->parent == 3 ) || ( $category->parent == 4 ) ){