Home › Forums › MapPress Support › Display all current queries on the map
- This topic has 12 replies, 2 voices, and was last updated 9 years, 10 months ago by
Chris.
-
AuthorPosts
-
March 7, 2013 at 3:59 am #11897
hi,
I have 15 results per page and I have as parameter : <?php echo do_shortcode(‘[mashup query="current" width="1050" height="350"]‘); ?> to displau my results on a map. That works perfectly !
When I have more than 15 results, it’s organised by pagination (like result page 1, result page 2, result page 3…)
Is it possible to display all results that meet my request on the map instead of only the one on the page (display ALL current QUERIES instead of all current RESULTS on the page)?
Sorry for my english, If I’m not clear enough don’t hesitate to make me explain differently.
Thank you for your help and congrats for this awesome plugin !
March 7, 2013 at 6:02 am #11902Hi,
I’m not sure I understood, but query=”current” means show only what’s on the current page. These queries will show ALL maps in your blog:
query=”posts_per_page=-1&post_type=any”
query=”all”
There are also some examples using post type, taxonomies, categories, etc. in the documentation:
http://mappresspro.com/mappress-documentation
I hope that helps…
March 7, 2013 at 6:15 am #11904Hi Chris,
Thanks for your answer and sorry for my english, it’s not my native language
Yes, I tried this one (query=”posts_per_page=-1&post_type=hotels”) , but it displays all the hotels on the map (not the hotel related to my research).
For example, say I have 600 registered hotels in my database.
I search all the hotels located in Paris.
I have a list of 50 hotels as results, of which only 15 are displayed as the first page of results, then the other over 3 other pages.
–> Currently, the map shows only the 15 results of the current page.
What I am looking to do is display all the 50 results on the map (but only results related to my research on paris, so 50 hotels)
I checked the documentation but I did not find any solution
I hope this is more understandable !
March 7, 2013 at 6:27 am #11905Hi,
Ah, I see what you mean now. I’m sorry, but when you use “current” the plugin takes the original query results exactly. It’s not possible to modify its parameters because it doesn’t re-run the query.
Maybe you could instead modify your do_shortcode() to use the query arguments from the page.
For example the parameter ‘s’ in the page URL is usually the search. This would then show you all hotels matching the current search (like “Paris”):
<?php $s = isset($_REQUEST['s']) ? "s=" . $_REQUEST['s'] : ""; $query = "post_type=hotels&posts_per_page=-1&" . $s; echo do_shortcode('[mashup query="' . $query . '" width="1050" height="350"]'); ?>
March 7, 2013 at 6:37 am #11906It works ! thank you so much !
EDIT: It worked because it displays all the hotels (I made a global research and it displayed all the hotel instead of the first 15)
But, It doesn’t work for Paris : All the hotels are displayed for every research.
I think you are very close ! Do you know what could be the reason?
March 7, 2013 at 6:57 am #11907I guess theere is an error in : “post_type=hotels&posts_per_page=-1&”
the “&” is wrong, right ?
I corrected this anyway but it shows all the hotels
March 7, 2013 at 7:07 am #11908Hi,
The “&” needs to be there, but only if there’s a search. Here’s the code with that change. I also added an “echo” at the bottom so you can see the page parameters:
<?php $s = isset($_REQUEST['s'])?"&s=". $_REQUEST['s']:""; $query ="post_type=hotels&posts_per_page=-1". $s; echo do_shortcode('[mashup query="'. $query .'" width="1050" height="350"]'); echo "<br/>"; echo "This is the request on the page: " . print_r($_REQUEST, true); ?>
March 7, 2013 at 8:15 pm #11913Hi Chris,
the list of result is right, I have all the hotels that meet the query. But the map seems to do not work correctly
I have only part of the results displayed on the map on for some query I do not have any results on the map at all
The page parameters seems to be ok
March 8, 2013 at 4:05 am #11917Hi,
I don’t know, perhaps if you send a URL I can see it. If you like, use the contact form to send a login as well it would help if I can see the backend too.
March 8, 2013 at 4:24 am #11918OK I Send it to you right now
March 8, 2013 at 6:53 am #11919I sent you an access with URL and for the tests I have displayed two maps :
——-> one with the snippet you provided :
<?php
$s = isset($_REQUEST[‘s’])?”&s=”. $_REQUEST[‘s’]:””;
$query =”post_type=typefichehotel&posts_per_page=-1″. $s;
echo do_shortcode(‘[mashup query="'. $query .'" width="1050" height="350"]‘);
echo “<br/>”;
echo “request format: ” . print_r($_REQUEST, true);
?>
(notice: “typefichehotel” is the right name of my custom content, but it search on every types btw)
——-> then one with the simple mashup shortcode :
<?php echo do_shortcode(‘[mashup query="current" width="1050" height="350" ]‘);?>
March 11, 2013 at 12:55 am #11936Hi Chris
did you received my Mail with the access ?
regards
March 12, 2013 at 4:34 am #11947Hi,
I think this is resolved and I’ll close the thread.
For anyone else looking through: in this case the MapPress query was in fact working, but another plugin (‘search everything’) was altering the query parameters.
So a search with “s=xyz” was in fact being converted to a search by tag “region=xyz”.
-
AuthorPosts
- The topic ‘Display all current queries on the map’ is closed to new replies.