Forums › Forums › Search & Filter Pro › Passing WP_Query to another plugin
- This topic has 17 replies, 3 voices, and was last updated 6 years, 9 months ago by
Ross.
-
Trevor(Private) December 5, 2018 at 10:41 am #195299
It looks like the data is being passed INSIDE the while loop. The basic archive structure is this:
if ( $query->have_posts() ) { // Pass the query here while ($query->have_posts()) { $query->the_post(); // Looks like the query is being passed here } }
Anonymous(Private) December 5, 2018 at 11:40 am #195315That eliminates the looping but the query results are empty. There may be something I’m missing in the documentation. I’m doing this:
if ( $query->have_posts() ) { echo GeoMashup::map([ 'map_content' => $query, 'show_future' => True, ]); while ($query->have_posts()) { // and so on
Does that look correct?
Trevor(Private) December 5, 2018 at 4:06 pm #195392Where you use
$query
are you sure that is the name of the query array? What does the map_content variable need by way of data? $query will give it the whole array. It might be useful to use print_r inside `HTML tags on that $query variable to see if it is empty or not.
Anonymous(Private) December 5, 2018 at 4:36 pm #195400Per the other plugin’s docs, the map_content variable takes a WP Query object.
When I print_r($query), it shows
WP_Query Object ( [query] => Array ( [paged] => 1 [search_filter_id] => 174371529654519 [search_filter_override] => [posts_per_page] => 10 [post_status] => Array ( [0] => publish ) [ignore_sticky_posts] => 1 [meta_query] => Array ( ) [post_type] => simcal-concerts [orderby] => Array ( [date] => ASC ) [date_query] => Array ( [after] => Array ( [day] => 05 [month] => 12 [year] => 2018 ) [before] => Array ( [day] => 01 [month] => 06 [year] => 2019 ) [inclusive] => 1 ) [post__in] => Array ( [0] => 174371529431586 [1] => 174371529431587 [2] => 174371529431588 [3] => 174371529431589 [4] => 174371529431590 [5] => 174371529431591 [6] => 174371529431592 [7] => 174371529431593 [8] => 174371529431595 [9] => 174371529431596 [10] =>
(…) and so on, through a fairly large number of results.When reloaded via AJAX, it shows something that looks more like a JSON response, with HTML characters escaped.
-
AuthorPosts