$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$MY_QUERY = new WP_Query($args);
?>
<?php if ($MY_QUERY->have_posts()) : ?>
<?php while ($MY_QUERY->have_posts()) : $MY_QUERY->the_post(); ?>
<div class="catalog">
<div class="container">
<div class="catalog-wrapper">
<div class="catalog-item">
<img src="<?php the_post_thumbnail_url(); ?>">
<div class="catalog-item-desc">
<p class='catalog-item-price'><?php the_field('apartment-price'); ?>$</p>
<p class='catalog-item-house'>Дом: <span class="recommend-color-text"><?php the_field('apartment-area'); ?>кв.м</span></p>
<p class='catalog-item-floors'>Этажность: <span class="recommend-color-text"><?php the_field('apartment-floors'); ?>х</span></p>
<p class='catalog-item-street'>Улица: <span class="recommend-color-text"><?php the_field('apartment-street'); ?></span></p>
<a class='recommend-item-more-btn' href="<?php echo get_permalink(); ?>">Подробнее</a>
<a class='recommend-item-tel-btn' href="<?php echo get_permalink(); ?>">Узнать номер</a>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
<div class="page_nav">
<?php
$GLOBALS['wp_query']->max_num_pages = $MY_QUERY->max_num_pages;
the_posts_pagination(array(
'type' => 'block',
'screen_reader_text' => (' '),
'end_size' => 1,
'mid_size' => 1,
'prev_next' => True,
'prev_text' => ('<i class="fa fa-angle-left"></i>'),
'next_text' => ('<i class="fa fa-angle-right"></i>'),
'add_args' => False
));
?>
</div>
</div>
</div>
<?php wp_reset_query(); // Restore global post data stomped by the_post().
?>
<?php if( $_GET['type'] ): ?>
<?php
$flat = $_GET['type'];
/* ... Остальные переменные ... */
$meta_query = array(
'relation' => 'AND',
array(
'key' => 'apartment-form-type',
'value' => $flat,
'compare' => '='
)
);
/* ... Остальные ключи ... */
$paged = get_query_var('page') ? get_query_var('page') : 1;
// args
$args = array(
'numberposts' => -1,
'posts_per_page'=>9,
'order' => 'DESC',
'post_type' => 'apartment',
'paged' => $paged,
'meta_query' => $meta_query);
// query
$the_query = new WP_Query( $args );
?>
<div class="catalog">
<div class="container">
<div class="catalog-wrapper">
<?php if( $the_query->have_posts() ): ?>
<?php while( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="catalog-item">
<img src="<?php the_post_thumbnail_url(); ?>">
<div class="catalog-item-desc">
<p class='catalog-item-price'><?php the_field('apartment-price'); ?>$</p>
<p class='catalog-item-house'>Дом: <span class="recommend-color-text"><?php the_field('apartment-area'); ?>кв.м</span></p>
<p class='catalog-item-floors'>Этажность: <span class="recommend-color-text"><?php the_field('apartment-floors'); ?>х</span></p>
<p class='catalog-item-street'>Улица: <span class="recommend-color-text"><?php the_field('apartment-street'); ?></span></p>
<div class='catalog-item-btns'>
<a class='catalog-item-more-btn' href="<?php echo get_permalink(); ?>">Подробнее</a>
<a class='catalog-item-tel-btn' href="<?php echo get_permalink(); ?>">Узнать номер</a>
</div>
</div>
</div>
<?php
endwhile;
endif;
?>
</div>
</div>
</div>
<?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
<?php endif; ?>
<?php if( empty($_GET['type']) ): ?>
<div class="selector">
<form action='/' method='get'>
<div class="select-flat"><select class="selector-big-field" name='type'>
<option value="Квартира">Квартира</option>
<option value="Дом">Дом</option>
<option value="Участок">Участок</option>
<option value="Коммерческая недвижимость">Коммерческая недвижимость</option>
</select></div>
<!-- ... Остальные инпуты ... -->
</form>
</div>
<?php endif; ?>
get_template_part()
, так же как и там__()
или _e()
. После чего вы сможете перевести эти строки на нужные вам языки плагином Loco Translate или программой Poedit