Думаю, я опубликую, что я сделал, чтобы получить эту работу. Спасибо @ tom-ukelove за то, что меня направили в правильном направлении.
У меня была карта, список и поисковый фильтр на этой странице. Фильтр поиска создается с помощью плагина Search & Filter.
https://scmamit.com/?sfid=756
В моих настройках Search & Filter я установил результаты для каждой страницы равными 25, что мне и требовалось для списка. сделать в цикле № 2.
Чтобы отобразить все результаты на карте (цикл № 1), я использовал следующий код для удаления предела 25 posts_per_page.
<?php
//get the search variables from URL
$this_keyword = $_GET['_sf_s'];
$this_provider_type = $_GET['_sft_provider_type'];
$this_city = $_GET['_sfm_city'];
//rebuild the query
$args = array(
'post_type' => 'providers',
'provider_type' => $this_provider_type,
's' => $this_keyword,
'meta_query' => array(
array(
'key' => 'city',
'value' => $this_city,
'compare' => 'LIKE'
)
),
//use -1 to remove the 25 results per page limit
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC'
);
$the_query = new WP_Query( $args );
global $wp_query;
// Put 25 limit query object in a temp variable
$tmp_query = $wp_query;
// Now purge the global query
$wp_query = null;
// Re-populate the global with the no-limit custom query
$wp_query = $the_query;
$count = $the_query->post_count;
//run the loop #1 and build map pins within.
while($the_query->have_posts()) : $the_query->the_post();
//echo out map pin code here, or whatever you need in the 1st loop.
endif;
endwhile;
//reset the query
wp_reset_query();
// Restore original 25 limit query object
$wp_query = null;
$wp_query = $tmp_query;
?>
<ul>
<?php
// run the 2nd loop with pagination
while(have_posts()) : the_post();
// some <ul> list here
endwhile;
?>
</ul>
<?php
//display pagination
$numeric_posts_nav();
?>
Надеюсь, чтопомогает кому-то в будущем. Лмк, если есть более эффективный способ сделать это.