hesabixWpTheme/index.php

64 lines
2 KiB
PHP

<?php
/**
* قالب fallback — آرشیو پست‌ها با ظاهر وبلاگ
*
* @package Hesabix2
*/
if (have_posts() && (is_home() || is_archive() || is_search())) {
$post_type = get_post_type();
if (!$post_type || 'post' === $post_type) {
if (is_category()) {
require locate_template('category.php', true);
return;
}
if (is_tag()) {
require locate_template('tag.php', true);
return;
}
if (is_author()) {
require locate_template('author.php', true);
return;
}
if (is_search()) {
require locate_template('search.php', true);
return;
}
require locate_template('archive.php', true);
return;
}
}
get_header();
$layout_class = function_exists('hesabix2_show_layout_sidebar') && hesabix2_show_layout_sidebar()
? 'layout-wrap layout--with-sidebar'
: 'layout-wrap layout--single';
?>
<div class="<?php echo esc_attr($layout_class); ?>">
<main id="main-content" class="site-main layout-main">
<div class="container mx-auto px-4 py-12">
<?php if (have_posts()) : ?>
<div class="blog-cards-grid grid grid-cols-1 md:grid-cols-2 gap-6">
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('template-parts/blog/card'); ?>
<?php endwhile; ?>
</div>
<nav class="mt-10">
<?php the_posts_pagination(); ?>
</nav>
<?php else : ?>
<p class="text-slate-600"><?php esc_html_e('محتوایی یافت نشد.', 'hesabix2'); ?></p>
<?php endif; ?>
</div>
</main>
<?php if (function_exists('hesabix2_show_layout_sidebar') && hesabix2_show_layout_sidebar()) : ?>
<aside class="layout-sidebar" role="complementary">
<?php dynamic_sidebar('sidebar-1'); ?>
</aside>
<?php endif; ?>
</div>
<?php
get_footer();