59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* قالب لیست مطالب وبلاگ
|
|
*
|
|
* @package Hesabix2
|
|
*/
|
|
|
|
get_header();
|
|
|
|
$search = isset($_GET['s']) ? sanitize_text_field(wp_unslash($_GET['s'])) : '';
|
|
$paged = max(1, (int) get_query_var('paged'));
|
|
|
|
global $wp_query;
|
|
$blog_query = $wp_query;
|
|
|
|
if ($search) {
|
|
$blog_query = new WP_Query(array(
|
|
'post_type' => 'post',
|
|
'posts_per_page' => get_option('posts_per_page', 9),
|
|
'paged' => $paged,
|
|
's' => $search,
|
|
'post_status' => 'publish',
|
|
));
|
|
}
|
|
|
|
$layout_class = hesabix2_blog_layout_class();
|
|
$show_featured = !$search && $paged < 2;
|
|
?>
|
|
|
|
<div class="<?php echo esc_attr($layout_class); ?>">
|
|
<main id="main-content" class="blog-archive layout-main min-h-screen bg-slate-50">
|
|
<?php
|
|
hesabix2_render_blog_archive_hero(
|
|
__('وبلاگ حسابیکس', 'hesabix2'),
|
|
__('جدیدترین اطلاعات و خبرها از دنیای حسابداری و مدیریت کسبوکار', 'hesabix2')
|
|
);
|
|
?>
|
|
|
|
<?php
|
|
get_template_part('template-parts/blog/archive-body', null, array(
|
|
'blog_query' => $blog_query,
|
|
'search' => $search,
|
|
'show_featured' => $show_featured,
|
|
));
|
|
?>
|
|
</main>
|
|
|
|
<?php if (hesabix2_show_layout_sidebar()) : ?>
|
|
<aside class="layout-sidebar" role="complementary">
|
|
<?php dynamic_sidebar('sidebar-1'); ?>
|
|
</aside>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php
|
|
if ($search) {
|
|
wp_reset_postdata();
|
|
}
|
|
get_footer();
|