Many Thanks for your reply.
I get this error, when I add the above code to the child’s theme functions.php: There has been a critical error on your website.
Below is how my functions.php file looks like without the above code:
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
add_filter( 'get_the_archive_title', function ($title) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>' ;
} elseif ( is_tax() ) { //for custom post types
$title = sprintf( __( '%1$s' ), single_term_title( '', false ) );
}
return $title;
});
/**
* Adds categories to the pages.
*/
function add_categories_to_pages() {
register_taxonomy_for_object_type( 'category', 'page');
}
add_action( 'init' , 'add_categories_to_pages' );
/**
* New Entry meta function to include author avatar image.
*/
function bayleaf_custom_entry_meta() {
global $post;
?>
<span<?php bayleaf_attr( 'meta-author-avatar' ); ?>>
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID', $post->post_author ) ) ); ?>"<?php bayleaf_attr( 'url' ); ?>><span<?php bayleaf_attr( 'name', false ); ?>> <?php echo get_avatar( get_the_author_meta( 'user_email', $post->post_author ), 36 ); ?></span></a>
</span><!-- .meta-author -->
<?php
bayleaf_entry_meta();
}
/**
* Modify entry meta callback function,
*/
function bayleaf_custom_modify_entry_meta() {
return [ 'bayleaf_custom_entry_meta' ];
}
add_filter( 'bayleaf_markup_entry_meta', 'bayleaf_custom_modify_entry_meta' );
/**
* Move entry meta below title,
*/
function bayleaf_custom_page_entry_header_items() {
return [
[ 'bayleaf_get_template_partial', 'template-parts/post', 'entry-title' ],
'bayleaf_entry_meta_wrapper',
];
}
add_filter( 'bayleaf_markup_page_entry_header_items', 'bayleaf_custom_page_entry_header_items' );