hesabixWpTheme/page.php
2026-05-22 13:52:15 +03:30

115 lines
3.6 KiB
PHP

<?php
/**
* قالب نمایش برگه (صفحه) — استایل مشابه قالب Hesabix
*
* @package Hesabix2
*/
get_header();
?>
<?php while (have_posts()) : the_post();
$plain = get_post_meta(get_the_ID(), 'plain', true);
?>
<?php if ( function_exists( 'hesabix2_wc_is_secondary_page_layout' ) && hesabix2_wc_is_secondary_page_layout() ) : ?>
<div class="hesabix-wc page-wrap woocommerce hesabix-wc--wrapped-page">
<div class="page-outer">
<div class="hesabix-wc__shell hesabix-wc__shell--narrow">
<?php woocommerce_breadcrumb( hesabix2_wc_breadcrumb_args() ); ?>
<div class="page-card hesabix-wc__card hesabix-wc__card--page-shell">
<div class="page-content hesabix-wc__shortcode-shell">
<?php the_content(); ?>
<?php
wp_link_pages(
array(
'before' => '<nav class="page-pagination hesabix-wc-pagination" aria-label="' . esc_attr__( 'صفحات', 'hesabix2' ) . '"><p class="page-pagination__label">' . esc_html__( 'صفحات:', 'hesabix2' ) . '</p><ul class="page-pagination__list">',
'after' => '</ul></nav>',
'link_before' => '<span>',
'link_after' => '</span>',
)
);
?>
</div>
</div>
</div>
</div>
</div>
<?php elseif ($plain) : ?>
<div class="page-plain-content">
<?php echo wp_kses_post($plain); ?>
</div>
<?php elseif ( get_the_content() ) : ?>
<main class="page-wrap">
<div class="page-outer">
<div class="page-inner">
<div class="page-card">
<?php if (has_post_thumbnail()) : ?>
<figure class="page-featured">
<?php the_post_thumbnail('large', array('class' => 'page-featured__img')); ?>
<?php if (get_the_post_thumbnail_caption()) : ?>
<figcaption class="page-featured__caption"><?php the_post_thumbnail_caption(); ?></figcaption>
<?php endif; ?>
</figure>
<?php endif; ?>
<h1 class="page-title"><?php the_title(); ?></h1>
<div class="page-content page-prose">
<?php the_content(); ?>
</div>
<?php
wp_link_pages(array(
'before' => '<nav class="page-pagination" aria-label="' . esc_attr__( 'صفحات', 'hesabix2' ) . '"><p class="page-pagination__label">' . esc_html__( 'صفحات:', 'hesabix2' ) . '</p><ul class="page-pagination__list">',
'after' => '</ul></nav>',
'link_before' => '<span>',
'link_after' => '</span>',
));
?>
</div>
</div>
</div>
<?php
$children = get_pages(array(
'parent' => get_the_ID(),
'sort_column' => 'menu_order,post_title',
));
if (!empty($children)) :
?>
<section class="page-children">
<div class="page-outer">
<div class="page-inner">
<h2 class="page-children__title"><?php esc_html_e( 'زیرصفحات', 'hesabix2' ); ?></h2>
<ul class="page-children__list">
<?php foreach ($children as $child) : ?>
<li>
<a href="<?php echo esc_url(get_permalink($child)); ?>" class="page-children__link">
<span class="page-children__icon"><?php echo esc_html(mb_substr($child->post_title, 0, 1)); ?></span>
<span class="page-children__text"><?php echo esc_html($child->post_title); ?></span>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</section>
<?php endif; ?>
<?php if (comments_open() || get_comments_number()) : ?>
<section class="page-comments">
<div class="page-outer">
<div class="page-inner">
<?php comments_template(); ?>
</div>
</div>
</section>
<?php endif; ?>
</main>
<?php endif; ?>
<?php endwhile; ?>
<?php
get_footer();