<?php

function aurora_lite_author_header_vars() {

    if ( ! is_author() ) return;

    $author_header_bg_color = get_theme_mod('aurora_lite_author_header_bg', '#004c40');

    $css = ':root { --author-header-bg-color: ' . esc_attr($author_header_bg_color) . '; }';
    wp_add_inline_style( 'aurora-lite-style', $css );
}
add_action('wp_enqueue_scripts', 'aurora_lite_author_header_vars');


function aurora_lite_author_post_count_title() {
    if ( ! is_author() ) {
        return;
    }

    $author = get_queried_object();

    if ( ! $author ) {
        return;
    }

    $count = count_user_posts( $author->ID, 'post', true );

    printf(
        '<h4 class="author-post-count">%s</h4>',
        sprintf(
            /* translators: %1$s: author display name, %2$d: number of posts */
            _n(
                "All %1\$s's %2\$d post",
                "All %1\$s's %2\$d posts",
                $count,
                'aurora-lite'
            ),
            esc_html( $author->display_name ),
            $count
        )
    );
    
}