|
|
@ -11,10 +11,14 @@ wp_localize_script('blog-archive-posts-ajax-js', 'ajax', array( |
|
|
|
'ajax_url' => admin_url('admin-ajax.php'), |
|
|
|
'ajax_url' => admin_url('admin-ajax.php'), |
|
|
|
)); |
|
|
|
)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
global $wp_query; |
|
|
|
|
|
|
|
|
|
|
|
$context = Timber::context(); |
|
|
|
$context = Timber::context(); |
|
|
|
$context['blog_title'] = get_field('blog_title', 'options'); |
|
|
|
$context['blog_title'] = get_field('blog_title', 'options'); |
|
|
|
$context['blog_desc'] = get_field('blog_desc', 'options'); |
|
|
|
$context['blog_desc'] = get_field('blog_desc', 'options'); |
|
|
|
$context['post_count'] = wp_count_posts()->publish; // Количество опубликованных постов |
|
|
|
$context['total_pages'] = $wp_query->max_num_pages; |
|
|
|
$context['total_pages'] = ceil($context['post_count'] / get_option('posts_per_page')); // Общее количество страниц |
|
|
|
if (is_category()) { |
|
|
|
|
|
|
|
$context['category'] = get_queried_object(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Timber::render('blog/blog-archive.twig', $context); |
|
|
|
Timber::render('blog/blog-archive.twig', $context); |
|
|
|