Show All Listings on Map
This topic contains 15 replies, has 3 voices, and was last updated by Wayne Harvey 10 years, 2 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: listings per page, Pagination, posts per page
-
AuthorPosts
-
September 24, 2014 at 9:00 pm #16448
Hi there,
Is there a way to show all listing on the map besides showing all posts per page? It might be nice to have both options so that some users can only show listings in the map that are on the current page, and another option to show all listings on the map regardless of how many listings are showing per page…
Thanks,
JonahSeptember 24, 2014 at 9:01 pm #16449If anybody is wanting to adjust how many listings are shown per page or get it so the map will show all listings, just add this code to your themes functions.php file:
/*------------------------------------------------------------------------------- Show More Posts Per Page -------------------------------------------------------------------------------*/ function show_more_posts($query) { if ( empty( $query->query_vars['suppress_filters'] ) ) { if( geodir_is_page('listing') || geodir_is_page('author') || geodir_is_page('search') ) { $query->set( 'posts_per_page', -1 ); } } return $query; } add_filter( 'pre_get_posts' , 'show_more_posts' );
That will affect listing, search and author GD pages.
September 25, 2014 at 7:16 pm #16574Thx for that.
Just FYI, if you have several hundreds listings in any given category, with this snippet, the map could take much longer than the rest of the page to load.
Cheers,
September 25, 2014 at 7:17 pm #16575No problem. Any thoughts on my question/suggestion/request to be able to show all listings on the map without my code though?
September 25, 2014 at 7:27 pm #16577I see three is note about it in our “improvements” to do list.
We eventually want to change the way map markers are queried, moving the ajax calls in a separate file. This to be able to fetch them quicker and to be able to cache them too.
When we will get to it, we will be able to also add options to display more markers in the map.
Can’t tell today how soon this will be done.
Thx
September 26, 2014 at 5:00 pm #16680Sounds good paolo, thanks!
October 16, 2014 at 5:21 pm #18598Hi there, I’m also looking to have the map on the listing pages show all of the listings. I tried the code provided above on the child theme functions.php file. It’s not working. Any ideas?
October 16, 2014 at 8:24 pm #18649Hey Wayne,
What version of GD are you running? Are you sure you added it to the currently active child theme? Are you seeing any errors or is it just not working?
– Jonah
October 16, 2014 at 8:32 pm #18651Hi Jonah
Thanks for the quick reply. I’m running the latest version of GD (1.2.4) and have definitely added it to the active child theme. My funtions.php file has one other customization that is functioning. There are no errors, the listing pages just continue to load 5 listings only as before – not sure if there is a setting to change that at all but I am looking for a method to just load all listings on the map. Cheers!October 16, 2014 at 8:56 pm #18653To show more listing in the list go to wp Settings >> Reading and change the number of visible posts.
Thx
October 16, 2014 at 9:41 pm #18664Hey Wayne,
I’m not sure why that code wouldn’t be working for you. Maybe try deactivating all other plugins to make sure no other plugin is interfering with things. You’ll need to troubleshoot on your own to figure it out. It works for me but unfortunately I can’t spend the time to figure out why it doesn’t work for you. Good luck!
– Jonah
October 17, 2014 at 3:57 pm #18729Hey Jonah, Thanks for the assistance. Cheers, Wayne
Hi Paolo,
Thanks for the suggestion, went to the WP “reading” settings and they were at their default of 10 posts. Changing the setting did not have any effect whatsoever.
When a user is viewing a province wide map by manually zooming in while on the homepage, then clicks on a detailed listing and then clicks on a “breadcrumb” link for the province, the behavior I’d expect is for the map to revert to showing all of the listings of the province, at least on the map if not on the list of listings.
For example if you go to my site – http://cabinrentalsonly.com/ – zoom in to British Columbia, Canada, click on any listing and then try to revert to all BC listings by clicking on the BC breadcrumb, the user then sees only 5 pins. I’m not sure where the “5” is coming from. What I’d like to see happen under this scenario is for the map to display “all” BC listings, even if the listings in the main content area are limited and paginated.
Any ideas? I would definitely +1 the addition of that functionality if I can’t achieve it by a code edit.
Many thanks, WayneOctober 17, 2014 at 7:10 pm #18747HI,
the listings page should show the number of posts set in reading settings.
The map currently can only show the number of listings availalbe in the list below. Not all and that apparently can be achieved with the function provided by Jonah.
In any case that would be a customization and you can request it here: https://wpgeodirectory.com/requests/
Now to see why it is only showing 5 instead of what’s set in your reading setting, I would need admin credentials.
Let me know,
Thx
October 17, 2014 at 10:54 pm #18781This reply has been marked as private.October 18, 2014 at 4:37 pm #18833Hi,
the theme used “Divi by elegantthemes.com” have settings that overwrites the default wordpress reading settings.
http://cabinrentalsonly.com/wp-admin/themes.php?page=core_functions.php
and these were your settings:
Number of Posts displayed on Category page 5
Number of Posts displayed on Archive pages 6
Number of Posts displayed on Search pages 5
Number of Posts displayed on Tag pages 5I’ve changed Archive page to 10 and it works.
I’ll set this as resolved.
Thx
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket