<?php

/**
 * @package BwlFaqManager
 */

namespace BwlFaqManager\Callbacks\Shortcodes;

class FaqAuthorCb {

	public function __construct() {}


	public function getFaqAuthor( $atts ) {

		global $post;

		extract(shortcode_atts([
			'post_id' => $post->ID,
		], $atts));

		$authorId   = get_post_field( 'post_author', $post_id );
		$authorInfo = get_the_author_meta( 'display_name', $authorId );

		$authorName = empty( $authorInfo ) ? esc_html__( 'Anonymous', 'bwl-adv-faq' ) : $authorInfo;

		return $authorName;
	}
}
