Show All Listings on Map

This topic contains 15 replies, has 3 voices, and was last updated by  Wayne Harvey 10 years, 1 month ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #16448

    jonahcoyote
    Expired Member
    Post count: 89

    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,
    Jonah

    #16449

    jonahcoyote
    Expired Member
    Post count: 89

    If 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.

    #16574

    Paolo
    Site Admin
    Post count: 31206

    Thx 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,

    #16575

    jonahcoyote
    Expired Member
    Post count: 89

    No problem. Any thoughts on my question/suggestion/request to be able to show all listings on the map without my code though?

    #16577

    Paolo
    Site Admin
    Post count: 31206

    I 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

    #16680

    jonahcoyote
    Expired Member
    Post count: 89

    Sounds good paolo, thanks!

    #18598

    Wayne Harvey
    Expired Member
    Post count: 102

    Hi 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?

    #18649

    jonahcoyote
    Expired Member
    Post count: 89

    Hey 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

    #18651

    Wayne Harvey
    Expired Member
    Post count: 102

    Hi 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!

    #18653

    Paolo
    Site Admin
    Post count: 31206

    To show more listing in the list go to wp Settings >> Reading and change the number of visible posts.

    Thx

    #18664

    jonahcoyote
    Expired Member
    Post count: 89

    Hey 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

    #18729

    Wayne Harvey
    Expired Member
    Post count: 102

    Hey 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, Wayne

    #18747

    Paolo
    Site Admin
    Post count: 31206

    HI,

    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

    #18781

    Wayne Harvey
    Expired Member
    Post count: 102
    This reply has been marked as private.
    #18833

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    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 5

    I’ve changed Archive page to 10 and it works.

    I’ll set this as resolved.

    Thx

Viewing 15 posts - 1 through 15 (of 16 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount