136 lines
7 KiB
PHP
136 lines
7 KiB
PHP
<?php
|
|
/**
|
|
* صفحه تکی سوال — طرح hesabix2
|
|
*
|
|
* @package Hesabix2
|
|
* @subpackage AnsPress
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
$question_id = get_the_ID();
|
|
$is_solved = ap_have_answer_selected( $question_id );
|
|
$is_private = is_private_post( $question_id );
|
|
$question_tags = get_the_terms( $question_id, 'question_tag' );
|
|
$comment_count = get_comments_number();
|
|
$time = ap_get_time( get_the_ID(), 'U' );
|
|
if ( 'future' !== get_post_status() ) {
|
|
$time = ap_human_time( $time );
|
|
}
|
|
?>
|
|
|
|
<div id="ap-single" class="ap-q hesabix2-ap-single clearfix" itemscope itemtype="https://schema.org/QAPage">
|
|
<!-- هدر سوال -->
|
|
<section class="ap-single-hero ap-hero-qa rounded-2xl mb-8 overflow-hidden">
|
|
<div class="relative z-10 px-6 py-8 sm:py-10">
|
|
<a href="<?php echo esc_url( ap_get_link_to( '/' ) ); ?>" class="inline-flex items-center gap-2 text-slate-600 hover:text-brand-600 mb-4 font-medium transition-colors">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path></svg>
|
|
<span><?php esc_html_e( 'بازگشت به لیست سوالات', 'anspress-question-answer' ); ?></span>
|
|
</a>
|
|
<h1 class="text-2xl sm:text-3xl lg:text-4xl font-extrabold text-slate-800 mb-3 tracking-tight" itemprop="name"><?php the_title(); ?></h1>
|
|
<div class="flex flex-wrap gap-2">
|
|
<?php if ( $is_solved ) : ?>
|
|
<span class="inline-flex items-center gap-1.5 px-3 py-1 bg-success-500/15 text-success-700 text-sm font-medium rounded-full border border-success-400/40">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
|
|
<?php esc_html_e( 'حل شده', 'anspress-question-answer' ); ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
<?php if ( $is_private ) : ?>
|
|
<span class="inline-flex items-center gap-1.5 px-3 py-1 bg-accent-500/15 text-accent-700 text-sm font-medium rounded-full border border-accent-400/40">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path></svg>
|
|
<?php esc_html_e( 'خصوصی', 'anspress-question-answer' ); ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<div class="flex flex-col lg:flex-row gap-8">
|
|
<div class="flex-1 min-w-0">
|
|
<?php do_action( 'ap_before_question_meta' ); ?>
|
|
|
|
<?php if ( function_exists( 'ap_question_metas' ) ) : ?>
|
|
<div class="ap-filters-bar rounded-2xl p-4 mb-6">
|
|
<div class="ap-question-meta clearfix"><?php ap_question_metas(); ?></div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php do_action( 'ap_after_question_meta' ); ?>
|
|
|
|
<!-- کارت سوال -->
|
|
<div ap="question" apid="<?php the_ID(); ?>" itemscope itemtype="https://schema.org/Question" itemprop="mainEntity">
|
|
<meta itemprop="@id" content="<?php the_ID(); ?>" />
|
|
<div class="ap-question-card ap-card-qa bg-white rounded-2xl shadow-sm border border-slate-100 overflow-hidden mb-6">
|
|
<div id="question" role="main" class="ap-content">
|
|
<div class="flex gap-6">
|
|
<?php if ( ! ap_opt( 'disable_voting_on_question' ) ) : ?>
|
|
<div class="flex-shrink-0 pt-6">
|
|
<div class="ap-single-vote"><?php ap_vote_btn(); ?></div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="flex-1 min-w-0 p-6">
|
|
<?php do_action( 'ap_before_question_title' ); ?>
|
|
|
|
<div class="flex items-center gap-4 mb-6 pb-6 border-b border-slate-100">
|
|
<div class="ap-avatar flex-shrink-0 ring-2 ring-white shadow-sm rounded-full overflow-hidden">
|
|
<a href="<?php ap_profile_link(); ?>"><?php ap_author_avatar( ap_opt( 'avatar_size_qquestion' ) ); ?></a>
|
|
</div>
|
|
<div class="flex flex-wrap items-center gap-4 text-sm text-slate-600">
|
|
<span class="ap-author font-medium text-slate-700" itemprop="author" itemscope itemtype="http://schema.org/Person"><?php ap_user_display_name( array( 'html' => true, 'echo' => true ) ); ?></span>
|
|
<a href="<?php the_permalink(); ?>" class="ap-posted flex items-center gap-1 text-slate-500 hover:text-brand-600 transition-colors">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
|
<time itemprop="datePublished" datetime="<?php echo esc_attr( ap_get_time( get_the_ID(), 'c' ) ); ?>"><?php echo esc_html( $time ); ?></time>
|
|
</a>
|
|
<?php if ( $comment_count > 0 ) : ?>
|
|
<span class="ap-comments-count flex items-center gap-1">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path></svg>
|
|
<span itemprop="commentCount"><?php echo (int) $comment_count; ?></span> <?php echo esc_html( _n( 'نظر', 'نظر', $comment_count, 'anspress-question-answer' ) ); ?>
|
|
</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ap-q-inner">
|
|
<?php do_action( 'ap_before_question_content' ); ?>
|
|
<div class="question-content ap-q-content mb-6 text-slate-700 leading-relaxed" itemprop="text"><?php the_content(); ?></div>
|
|
<?php do_action( 'ap_after_question_content' ); ?>
|
|
|
|
<?php if ( ! empty( $question_tags ) && ! is_wp_error( $question_tags ) ) : ?>
|
|
<div class="flex flex-wrap gap-2 mb-6" itemprop="keywords">
|
|
<?php foreach ( $question_tags as $tag ) : ?>
|
|
<a href="<?php echo esc_url( get_term_link( $tag ) ); ?>" class="ap-tag inline-flex px-3 py-1 bg-light-100 text-brand-600 rounded-full text-sm font-medium hover:bg-brand-500/10 transition-colors"><?php echo esc_html( $tag->name ); ?></a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="ap-post-footer flex items-center justify-between pt-6 border-t border-slate-100">
|
|
<div class="flex items-center gap-3"><?php ap_post_actions_buttons(); ?></div>
|
|
<?php do_action( 'ap_post_footer' ); ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-6 pt-6 border-t border-slate-100"><?php ap_post_comments(); ?></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php do_action( 'ap_before_answers' ); ?>
|
|
|
|
<div class="mt-8">
|
|
<?php ap_answers(); ?>
|
|
<?php ap_get_template_part( 'answer-form' ); ?>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if ( is_active_sidebar( 'ap-qsidebar' ) ) : ?>
|
|
<aside class="lg:w-72 flex-shrink-0">
|
|
<div class="ap-question-info space-y-6 ap-sidebar-card-qa"><?php dynamic_sidebar( 'ap-qsidebar' ); ?></div>
|
|
</aside>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|