<?php
/**
 * Partial template for displaying the post author box on single post pages.
 *
 * Responsible for rendering the author's details, including name, bio, and social links.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package Yaatra
 */

// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * hook - yaatra_before_post_author
 * 
 * @since 1.1.0
 */
do_action( 'yaatra_before_post_author' );

global $post;
$author_id          = $post->post_author;
$author_nickname    = get_the_author_meta( 'display_name', $author_id );
$np_author_website  = get_the_author_meta( 'user_url', $author_id );
?>
<div class="cv-author-box-wrapper clearfix">
    <div class="author-avatar">
        <a class="author-image" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );?>">
            <?php echo get_avatar( $author_id, '132' ); ?>
        </a>
    </div><!-- .author-avatar -->

    <div class="author-desc-wrapper">                
        <a class="author-title" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );?>"><?php echo esc_html( $author_nickname ); ?></a>
        <div class="author-description"><?php echo wp_kses_post( wpautop( get_the_author_meta( 'description', $author_id ) ) ); ?></div>
        <div class="author-social">
            <?php get_template_part( 'template-parts/partials/social', 'icons' ); ?>
        </div><!-- .author-social -->
        <?php if ( !empty( $np_author_website ) ) { ?>
            <a href="<?php echo esc_url( $np_author_website ); ?>" target="_blank" class="admin-dec"><?php echo esc_url( $np_author_website ); ?></a>
        <?php } ?>
    </div><!-- .author-desc-wrapper-->
</div><!-- .cv-author-box-wrapper -->

<?php
/**
 * hook - yaatra_after_post_author
 * 
 * @since 1.1.0
 */
do_action( 'yaatra_after_post_author' );