Allows you to modify the value of a field before it’s rendered on the single book template. Here’s an example from one of Novelist’s functions for adding Schema.org markup around the book title:
/**
* Title: Add Schema
*
* Adds schema.org markup around the book title.
*
* @param string $value Final formatted value
* @param string $key The key that is being filtered
* @param array $all_fields All available book fields
* @param array $enabled_fields Only the fields that are enabled
* @param Novelist_Book $book Book object
*
* @since 1.0.0
* @return string
*/
function novelist_add_schema_title( $value, $key, $all_fields, $enabled_fields, $book ) {
if ( empty( $value ) ) {
return $value;
}
return '<span itemprop="name">' . $value . '</span>';
}
add_filter( 'novelist/book/pre-render/title', 'novelist_add_schema_title', 10, 5 );
This filter is run before the value is inserted into the template and before any line breaks are added to the end. If you want to modify a field after those occur, look at the novelist/book/render/$k